Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/angular2/angular2.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export * from './core';
export * from './annotations';
export * from './directives';
export * from './forms';
export {Observable, EventEmitter} from 'angular2/src/facade/async';
39 changes: 39 additions & 0 deletions modules/angular2/src/core/annotations/annotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,30 @@ export class Directive extends Injectable {
*/
properties:any; // StringMap

/**
* Enumerates the set of emitted events.
*
* ## Syntax
*
* ```
* @Component({
* events: ['status-change']
* })
* class TaskComponent {
* statusChange:EventEmitter;
*
* constructor() {
* this.complete = new EventEmitter();
* }
*
* onComplete() {
* this.statusChange.next("completed");
* }
* }
* ```
*/
events:List<string>;

/**
* Specifies which DOM hostListeners a directive listens to.
*
Expand Down Expand Up @@ -426,18 +450,21 @@ export class Directive extends Injectable {
constructor({
selector,
properties,
events,
hostListeners,
lifecycle
}:{
selector:string,
properties:any,
events:List,
hostListeners: any,
lifecycle:List
}={})
{
super();
this.selector = selector;
this.properties = properties;
this.events = events;
this.hostListeners = hostListeners;
this.lifecycle = lifecycle;
}
Expand Down Expand Up @@ -551,13 +578,15 @@ export class Component extends Directive {
constructor({
selector,
properties,
events,
hostListeners,
injectables,
lifecycle,
changeDetection = DEFAULT
}:{
selector:string,
properties:Object,
events:List,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could this be List<string>?

hostListeners:Object,
injectables:List,
lifecycle:List,
Expand All @@ -567,6 +596,7 @@ export class Component extends Directive {
super({
selector: selector,
properties: properties,
events: events,
hostListeners: hostListeners,
lifecycle: lifecycle
});
Expand Down Expand Up @@ -634,19 +664,22 @@ export class DynamicComponent extends Directive {
constructor({
selector,
properties,
events,
hostListeners,
injectables,
lifecycle
}:{
selector:string,
properties:Object,
events:List,
hostListeners:Object,
injectables:List,
lifecycle:List
}={}) {
super({
selector: selector,
properties: properties,
events: events,
hostListeners: hostListeners,
lifecycle: lifecycle
});
Expand Down Expand Up @@ -727,12 +760,14 @@ export class Decorator extends Directive {
constructor({
selector,
properties,
events,
hostListeners,
lifecycle,
compileChildren = true,
}:{
selector:string,
properties:any,
events:List,
hostListeners:any,
lifecycle:List,
compileChildren:boolean
Expand All @@ -741,6 +776,7 @@ export class Decorator extends Directive {
super({
selector: selector,
properties: properties,
events: events,
hostListeners: hostListeners,
lifecycle: lifecycle
});
Expand Down Expand Up @@ -846,17 +882,20 @@ export class Viewport extends Directive {
constructor({
selector,
properties,
events,
hostListeners,
lifecycle
}:{
selector:string,
properties:any,
events:List,
lifecycle:List
}={})
{
super({
selector: selector,
properties: properties,
events: events,
hostListeners: hostListeners,
lifecycle: lifecycle
});
Expand Down
25 changes: 1 addition & 24 deletions modules/angular2/src/core/annotations/di.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,11 @@
import {CONST} from 'angular2/src/facade/lang';
import {DependencyAnnotation} from 'angular2/di';

/**
* Specifies that a function for emitting events should be injected.
*
* NOTE: This is changing pre 1.0.
*
* The directive can inject an emitter function that would emit events onto the directive host element.
*
* @exportedAs angular2/annotations
*/
export class EventEmitter extends DependencyAnnotation {
eventName: string;

@CONST()
constructor(eventName) {
super();
this.eventName = eventName;
}

get token() {
return Function;
}
}

/**
* Specifies that a function for setting host properties should be injected.
*
* NOTE: This is changing pre 1.0.
*
*
* The directive can inject a property setter that would allow setting this property on the host element.
*
* @exportedAs angular2/annotations
Expand Down
Loading