2015-02-05 13:08:05 -08:00
|
|
|
import {CONST} from 'angular2/src/facade/lang';
|
|
|
|
|
import {DependencyAnnotation} from 'angular2/di';
|
2015-01-16 15:30:22 -08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The directive can inject an emitter function that would emit events onto the
|
|
|
|
|
* directive host element.
|
|
|
|
|
*/
|
|
|
|
|
export class EventEmitter extends DependencyAnnotation {
|
|
|
|
|
eventName: string;
|
|
|
|
|
@CONST()
|
|
|
|
|
constructor(eventName) {
|
2015-02-06 13:38:52 -08:00
|
|
|
super();
|
2015-01-16 15:30:22 -08:00
|
|
|
this.eventName = eventName;
|
|
|
|
|
}
|
2015-03-29 14:56:18 +02:00
|
|
|
|
|
|
|
|
get token() {
|
|
|
|
|
return Function;
|
|
|
|
|
}
|
2015-01-16 15:30:22 -08:00
|
|
|
}
|
2015-03-06 18:12:48 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The directive can inject a property setter that would allow setting this property on the
|
|
|
|
|
* host element
|
|
|
|
|
*/
|
|
|
|
|
export class PropertySetter extends DependencyAnnotation {
|
|
|
|
|
propName: string;
|
|
|
|
|
@CONST()
|
|
|
|
|
constructor(propName) {
|
|
|
|
|
super();
|
|
|
|
|
this.propName = propName;
|
|
|
|
|
}
|
2015-03-29 14:56:18 +02:00
|
|
|
|
|
|
|
|
get token() {
|
|
|
|
|
return Function;
|
|
|
|
|
}
|
2015-03-06 18:12:48 +01:00
|
|
|
}
|
2015-03-25 09:42:19 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The directive can inject the value of an attribute of the host element
|
|
|
|
|
*/
|
|
|
|
|
export class Attribute extends DependencyAnnotation {
|
|
|
|
|
attributeName: string;
|
|
|
|
|
@CONST()
|
|
|
|
|
constructor(attributeName) {
|
|
|
|
|
super();
|
|
|
|
|
this.attributeName = attributeName;
|
|
|
|
|
}
|
2015-04-03 17:23:13 +02:00
|
|
|
|
|
|
|
|
get token() {
|
|
|
|
|
//Normally one would default a token to a type of an injected value but here
|
|
|
|
|
//the type of a variable is "string" and we can't use primitive type as a return value
|
|
|
|
|
//so we use instance of Attribute instead. This doesn't matter much in practice as arguments
|
|
|
|
|
//with @Attribute annotation are injected by ElementInjector that doesn't take tokens into account.
|
|
|
|
|
return this;
|
|
|
|
|
}
|
2015-03-25 09:42:19 +01:00
|
|
|
}
|
2015-03-13 11:39:15 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The directive can inject an query that would reflect a list of ancestor directives
|
|
|
|
|
*/
|
|
|
|
|
export class Query extends DependencyAnnotation {
|
|
|
|
|
directive;
|
|
|
|
|
@CONST()
|
|
|
|
|
constructor(directive) {
|
|
|
|
|
super();
|
|
|
|
|
this.directive = directive;
|
|
|
|
|
}
|
|
|
|
|
}
|