feat(core): renames Property into Input and Event into Output

BREACKING CHANGE:

Before: @Directive({properties: ['one'], events: ['two']})
After: @Directive({inputs: ['one'], outputs: ['two']})

Before: @Component({properties: ['one'], events: ['two']})
After: @Componet({inputs: ['one'], outputs: ['two']})

Before: class A {@Property() one; @Event() two;}
After: class A {@Input() one; @Output() two;}
This commit is contained in:
vsavkin 2015-09-30 20:59:23 -07:00
parent 33593cf8a2
commit adbfd29fd7
89 changed files with 405 additions and 423 deletions

View File

@ -77,8 +77,8 @@ class ProtoViewVisitor implements TemplateAstVisitor {
if (ast.isBound()) { if (ast.isBound()) {
this.boundElementCount++; this.boundElementCount++;
} }
templateVisitAll(this, ast.properties, null); templateVisitAll(this, ast.inputs, null);
templateVisitAll(this, ast.events); templateVisitAll(this, ast.outputs);
templateVisitAll(this, ast.exportAsVars); templateVisitAll(this, ast.exportAsVars);
for (var i = 0; i < ast.directives.length; i++) { for (var i = 0; i < ast.directives.length; i++) {
ast.directives[i].visit(this, i); ast.directives[i].visit(this, i);
@ -158,7 +158,7 @@ class ProtoViewVisitor implements TemplateAstVisitor {
}); });
this.directiveRecords.push(directiveRecord); this.directiveRecords.push(directiveRecord);
templateVisitAll(this, ast.properties, directiveRecord); templateVisitAll(this, ast.inputs, directiveRecord);
var bindingRecords = this.bindingRecords; var bindingRecords = this.bindingRecords;
if (directiveRecord.callOnChanges) { if (directiveRecord.callOnChanges) {
bindingRecords.push(BindingRecord.createDirectiveOnChanges(directiveRecord)); bindingRecords.push(BindingRecord.createDirectiveOnChanges(directiveRecord));

View File

@ -246,7 +246,7 @@ class CommandBuilderVisitor<R> implements TemplateAstVisitor {
} }
visitElement(ast: ElementAst, context: any): any { visitElement(ast: ElementAst, context: any): any {
var component = ast.getComponent(); var component = ast.getComponent();
var eventTargetAndNames = visitAndReturnContext(this, ast.events, []); var eventTargetAndNames = visitAndReturnContext(this, ast.outputs, []);
var variableNameAndValues = []; var variableNameAndValues = [];
if (isBlank(component)) { if (isBlank(component)) {
ast.exportAsVars.forEach((varAst) => { ast.exportAsVars.forEach((varAst) => {

View File

@ -94,16 +94,16 @@ export class CompileTemplateMetadata {
} }
export class CompileDirectiveMetadata { export class CompileDirectiveMetadata {
static create({type, isComponent, dynamicLoadable, selector, exportAs, changeDetection, static create({type, isComponent, dynamicLoadable, selector, exportAs, changeDetection, inputs,
properties, events, host, lifecycleHooks, template}: { outputs, host, lifecycleHooks, template}: {
type?: CompileTypeMetadata, type?: CompileTypeMetadata,
isComponent?: boolean, isComponent?: boolean,
dynamicLoadable?: boolean, dynamicLoadable?: boolean,
selector?: string, selector?: string,
exportAs?: string, exportAs?: string,
changeDetection?: ChangeDetectionStrategy, changeDetection?: ChangeDetectionStrategy,
properties?: string[], inputs?: string[],
events?: string[], outputs?: string[],
host?: StringMap<string, string>, host?: StringMap<string, string>,
lifecycleHooks?: LifecycleHooks[], lifecycleHooks?: LifecycleHooks[],
template?: CompileTemplateMetadata template?: CompileTemplateMetadata
@ -123,22 +123,22 @@ export class CompileDirectiveMetadata {
} }
}); });
} }
var propsMap = {}; var inputsMap = {};
if (isPresent(properties)) { if (isPresent(inputs)) {
properties.forEach((bindConfig: string) => { inputs.forEach((bindConfig: string) => {
// canonical syntax: `dirProp: elProp` // canonical syntax: `dirProp: elProp`
// if there is no `:`, use dirProp = elProp // if there is no `:`, use dirProp = elProp
var parts = splitAtColon(bindConfig, [bindConfig, bindConfig]); var parts = splitAtColon(bindConfig, [bindConfig, bindConfig]);
propsMap[parts[0]] = parts[1]; inputsMap[parts[0]] = parts[1];
}); });
} }
var eventsMap = {}; var outputsMap = {};
if (isPresent(events)) { if (isPresent(outputs)) {
events.forEach((bindConfig: string) => { outputs.forEach((bindConfig: string) => {
// canonical syntax: `dirProp: elProp` // canonical syntax: `dirProp: elProp`
// if there is no `:`, use dirProp = elProp // if there is no `:`, use dirProp = elProp
var parts = splitAtColon(bindConfig, [bindConfig, bindConfig]); var parts = splitAtColon(bindConfig, [bindConfig, bindConfig]);
eventsMap[parts[0]] = parts[1]; outputsMap[parts[0]] = parts[1];
}); });
} }
@ -149,8 +149,8 @@ export class CompileDirectiveMetadata {
selector: selector, selector: selector,
exportAs: exportAs, exportAs: exportAs,
changeDetection: changeDetection, changeDetection: changeDetection,
properties: propsMap, inputs: inputsMap,
events: eventsMap, outputs: outputsMap,
hostListeners: hostListeners, hostListeners: hostListeners,
hostProperties: hostProperties, hostProperties: hostProperties,
hostAttributes: hostAttributes, hostAttributes: hostAttributes,
@ -164,23 +164,23 @@ export class CompileDirectiveMetadata {
selector: string; selector: string;
exportAs: string; exportAs: string;
changeDetection: ChangeDetectionStrategy; changeDetection: ChangeDetectionStrategy;
properties: StringMap<string, string>; inputs: StringMap<string, string>;
events: StringMap<string, string>; outputs: StringMap<string, string>;
hostListeners: StringMap<string, string>; hostListeners: StringMap<string, string>;
hostProperties: StringMap<string, string>; hostProperties: StringMap<string, string>;
hostAttributes: StringMap<string, string>; hostAttributes: StringMap<string, string>;
lifecycleHooks: LifecycleHooks[]; lifecycleHooks: LifecycleHooks[];
template: CompileTemplateMetadata; template: CompileTemplateMetadata;
constructor({type, isComponent, dynamicLoadable, selector, exportAs, changeDetection, properties, constructor({type, isComponent, dynamicLoadable, selector, exportAs, changeDetection, inputs,
events, hostListeners, hostProperties, hostAttributes, lifecycleHooks, template}: { outputs, hostListeners, hostProperties, hostAttributes, lifecycleHooks, template}: {
type?: CompileTypeMetadata, type?: CompileTypeMetadata,
isComponent?: boolean, isComponent?: boolean,
dynamicLoadable?: boolean, dynamicLoadable?: boolean,
selector?: string, selector?: string,
exportAs?: string, exportAs?: string,
changeDetection?: ChangeDetectionStrategy, changeDetection?: ChangeDetectionStrategy,
properties?: StringMap<string, string>, inputs?: StringMap<string, string>,
events?: StringMap<string, string>, outputs?: StringMap<string, string>,
hostListeners?: StringMap<string, string>, hostListeners?: StringMap<string, string>,
hostProperties?: StringMap<string, string>, hostProperties?: StringMap<string, string>,
hostAttributes?: StringMap<string, string>, hostAttributes?: StringMap<string, string>,
@ -193,8 +193,8 @@ export class CompileDirectiveMetadata {
this.selector = selector; this.selector = selector;
this.exportAs = exportAs; this.exportAs = exportAs;
this.changeDetection = changeDetection; this.changeDetection = changeDetection;
this.properties = properties; this.inputs = inputs;
this.events = events; this.outputs = outputs;
this.hostListeners = hostListeners; this.hostListeners = hostListeners;
this.hostProperties = hostProperties; this.hostProperties = hostProperties;
this.hostAttributes = hostAttributes; this.hostAttributes = hostAttributes;
@ -212,8 +212,8 @@ export class CompileDirectiveMetadata {
changeDetection: isPresent(data['changeDetection']) ? changeDetection: isPresent(data['changeDetection']) ?
CHANGE_DECTION_STRATEGY_VALUES[data['changeDetection']] : CHANGE_DECTION_STRATEGY_VALUES[data['changeDetection']] :
data['changeDetection'], data['changeDetection'],
properties: data['properties'], inputs: data['inputs'],
events: data['events'], outputs: data['outputs'],
hostListeners: data['hostListeners'], hostListeners: data['hostListeners'],
hostProperties: data['hostProperties'], hostProperties: data['hostProperties'],
hostAttributes: data['hostAttributes'], hostAttributes: data['hostAttributes'],
@ -233,8 +233,8 @@ export class CompileDirectiveMetadata {
'type': isPresent(this.type) ? this.type.toJson() : this.type, 'type': isPresent(this.type) ? this.type.toJson() : this.type,
'changeDetection': isPresent(this.changeDetection) ? serializeEnum(this.changeDetection) : 'changeDetection': isPresent(this.changeDetection) ? serializeEnum(this.changeDetection) :
this.changeDetection, this.changeDetection,
'properties': this.properties, 'inputs': this.inputs,
'events': this.events, 'outputs': this.outputs,
'hostListeners': this.hostListeners, 'hostListeners': this.hostListeners,
'hostProperties': this.hostProperties, 'hostProperties': this.hostProperties,
'hostAttributes': this.hostAttributes, 'hostAttributes': this.hostAttributes,
@ -253,8 +253,8 @@ export function createHostComponentMeta(componentType: CompileTypeMetadata,
template: new CompileTemplateMetadata( template: new CompileTemplateMetadata(
{template: template, templateUrl: '', styles: [], styleUrls: [], ngContentSelectors: []}), {template: template, templateUrl: '', styles: [], styleUrls: [], ngContentSelectors: []}),
changeDetection: ChangeDetectionStrategy.Default, changeDetection: ChangeDetectionStrategy.Default,
properties: [], inputs: [],
events: [], outputs: [],
host: {}, host: {},
lifecycleHooks: [], lifecycleHooks: [],
isComponent: true, isComponent: true,

View File

@ -58,8 +58,8 @@ export class RuntimeMetadataResolver {
{name: stringify(directiveType), moduleId: moduleId, runtime: directiveType}), {name: stringify(directiveType), moduleId: moduleId, runtime: directiveType}),
template: templateMeta, template: templateMeta,
changeDetection: changeDetectionStrategy, changeDetection: changeDetectionStrategy,
properties: directiveAnnotation.properties, inputs: directiveAnnotation.inputs,
events: directiveAnnotation.events, outputs: directiveAnnotation.outputs,
host: directiveAnnotation.host, host: directiveAnnotation.host,
lifecycleHooks: ListWrapper.filter(LIFECYCLE_HOOKS_VALUES, lifecycleHooks: ListWrapper.filter(LIFECYCLE_HOOKS_VALUES,
hook => hasLifecycleHook(hook, directiveType)) hook => hasLifecycleHook(hook, directiveType))

View File

@ -56,7 +56,7 @@ export class VariableAst implements TemplateAst {
export class ElementAst implements TemplateAst { export class ElementAst implements TemplateAst {
constructor(public name: string, public attrs: AttrAst[], constructor(public name: string, public attrs: AttrAst[],
public properties: BoundElementPropertyAst[], public events: BoundEventAst[], public inputs: BoundElementPropertyAst[], public outputs: BoundEventAst[],
public exportAsVars: VariableAst[], public directives: DirectiveAst[], public exportAsVars: VariableAst[], public directives: DirectiveAst[],
public children: TemplateAst[], public ngContentIndex: number, public children: TemplateAst[], public ngContentIndex: number,
public sourceInfo: string) {} public sourceInfo: string) {}
@ -65,7 +65,7 @@ export class ElementAst implements TemplateAst {
} }
isBound(): boolean { isBound(): boolean {
return (this.properties.length > 0 || this.events.length > 0 || this.exportAsVars.length > 0 || return (this.inputs.length > 0 || this.outputs.length > 0 || this.exportAsVars.length > 0 ||
this.directives.length > 0); this.directives.length > 0);
} }
@ -95,7 +95,7 @@ export class BoundDirectivePropertyAst implements TemplateAst {
export class DirectiveAst implements TemplateAst { export class DirectiveAst implements TemplateAst {
constructor(public directive: CompileDirectiveMetadata, constructor(public directive: CompileDirectiveMetadata,
public properties: BoundDirectivePropertyAst[], public inputs: BoundDirectivePropertyAst[],
public hostProperties: BoundElementPropertyAst[], public hostEvents: BoundEventAst[], public hostProperties: BoundElementPropertyAst[], public hostEvents: BoundEventAst[],
public exportAsVars: VariableAst[], public sourceInfo: string) {} public exportAsVars: VariableAst[], public sourceInfo: string) {}
visit(visitor: TemplateAstVisitor, context: any): any { visit(visitor: TemplateAstVisitor, context: any): any {

View File

@ -65,8 +65,8 @@ export class TemplateCompiler {
selector: directive.selector, selector: directive.selector,
exportAs: directive.exportAs, exportAs: directive.exportAs,
changeDetection: directive.changeDetection, changeDetection: directive.changeDetection,
properties: directive.properties, inputs: directive.inputs,
events: directive.events, outputs: directive.outputs,
hostListeners: directive.hostListeners, hostListeners: directive.hostListeners,
hostProperties: directive.hostProperties, hostProperties: directive.hostProperties,
hostAttributes: directive.hostAttributes, hostAttributes: directive.hostAttributes,

View File

@ -415,7 +415,7 @@ class TemplateParseVisitor implements HtmlAstVisitor {
this._createDirectiveHostPropertyAsts(elementName, directive.hostProperties, sourceInfo, this._createDirectiveHostPropertyAsts(elementName, directive.hostProperties, sourceInfo,
hostProperties); hostProperties);
this._createDirectiveHostEventAsts(directive.hostListeners, sourceInfo, hostEvents); this._createDirectiveHostEventAsts(directive.hostListeners, sourceInfo, hostEvents);
this._createDirectivePropertyAsts(directive.properties, props, directiveProperties); this._createDirectivePropertyAsts(directive.inputs, props, directiveProperties);
var exportAsVars = []; var exportAsVars = [];
possibleExportAsVars.forEach((varAst) => { possibleExportAsVars.forEach((varAst) => {
if ((varAst.value.length === 0 && directive.isComponent) || if ((varAst.value.length === 0 && directive.isComponent) ||
@ -489,7 +489,7 @@ class TemplateParseVisitor implements HtmlAstVisitor {
var boundElementProps: BoundElementPropertyAst[] = []; var boundElementProps: BoundElementPropertyAst[] = [];
var boundDirectivePropsIndex = new Map<string, BoundDirectivePropertyAst>(); var boundDirectivePropsIndex = new Map<string, BoundDirectivePropertyAst>();
directives.forEach((directive: DirectiveAst) => { directives.forEach((directive: DirectiveAst) => {
directive.properties.forEach((prop: BoundDirectivePropertyAst) => { directive.inputs.forEach((prop: BoundDirectivePropertyAst) => {
boundDirectivePropsIndex.set(prop.templateName, prop); boundDirectivePropsIndex.set(prop.templateName, prop);
}); });
}); });

View File

@ -157,7 +157,7 @@ export class ChangeDetectorRef {
* } * }
* } * }
* *
* @Component({selector: 'live-data', properties: ['live']}) * @Component({selector: 'live-data', inputs: ['live']})
* @View({ * @View({
* template: `Data: {{dataProvider.data}}` * template: `Data: {{dataProvider.data}}`
* }) * })

View File

@ -21,7 +21,7 @@ import {BaseException, WrappedException} from "angular2/src/core/facade/exceptio
* parentProp = "init"; * parentProp = "init";
* } * }
* *
* @Directive({selector: 'child', properties: ['prop']}) * @Directive({selector: 'child', inputs: ['prop']})
* class Child { * class Child {
* constructor(public parent: Parent) {} * constructor(public parent: Parent) {}
* *
@ -49,7 +49,7 @@ export class ExpressionChangedAfterItHasBeenCheckedException extends BaseExcepti
* ### Example ([live demo](http://plnkr.co/edit/2Kywoz?p=preview)) * ### Example ([live demo](http://plnkr.co/edit/2Kywoz?p=preview))
* *
* ```typescript * ```typescript
* @Directive({selector: 'child', properties: ['prop']}) * @Directive({selector: 'child', inputs: ['prop']})
* class Child { * class Child {
* prop; * prop;
* } * }

View File

@ -5,8 +5,8 @@ import {ListWrapper, StringMap, StringMapWrapper} from 'angular2/src/core/facade
import { import {
DirectiveMetadata, DirectiveMetadata,
ComponentMetadata, ComponentMetadata,
PropertyMetadata, InputMetadata,
EventMetadata, OutputMetadata,
HostBindingMetadata, HostBindingMetadata,
HostListenerMetadata, HostListenerMetadata,
ContentChildrenMetadata, ContentChildrenMetadata,
@ -45,26 +45,26 @@ export class DirectiveResolver {
private _mergeWithPropertyMetadata(dm: DirectiveMetadata, private _mergeWithPropertyMetadata(dm: DirectiveMetadata,
propertyMetadata: propertyMetadata:
StringMap<string, any[]>): DirectiveMetadata { StringMap<string, any[]>): DirectiveMetadata {
var properties = []; var inputs = [];
var events = []; var outputs = [];
var host = {}; var host = {};
var queries = {}; var queries = {};
StringMapWrapper.forEach(propertyMetadata, (metadata: any[], propName: string) => { StringMapWrapper.forEach(propertyMetadata, (metadata: any[], propName: string) => {
metadata.forEach(a => { metadata.forEach(a => {
if (a instanceof PropertyMetadata) { if (a instanceof InputMetadata) {
if (isPresent(a.bindingPropertyName)) { if (isPresent(a.bindingPropertyName)) {
properties.push(`${propName}: ${a.bindingPropertyName}`); inputs.push(`${propName}: ${a.bindingPropertyName}`);
} else { } else {
properties.push(propName); inputs.push(propName);
} }
} }
if (a instanceof EventMetadata) { if (a instanceof OutputMetadata) {
if (isPresent(a.bindingPropertyName)) { if (isPresent(a.bindingPropertyName)) {
events.push(`${propName}: ${a.bindingPropertyName}`); outputs.push(`${propName}: ${a.bindingPropertyName}`);
} else { } else {
events.push(propName); outputs.push(propName);
} }
} }
@ -98,15 +98,14 @@ export class DirectiveResolver {
} }
}); });
}); });
return this._merge(dm, properties, events, host, queries); return this._merge(dm, inputs, outputs, host, queries);
} }
private _merge(dm: DirectiveMetadata, properties: string[], events: string[], private _merge(dm: DirectiveMetadata, inputs: string[], outputs: string[],
host: StringMap<string, string>, host: StringMap<string, string>,
queries: StringMap<string, any>): DirectiveMetadata { queries: StringMap<string, any>): DirectiveMetadata {
var mergedProperties = var mergedInputs = isPresent(dm.inputs) ? ListWrapper.concat(dm.inputs, inputs) : inputs;
isPresent(dm.properties) ? ListWrapper.concat(dm.properties, properties) : properties; var mergedOutputs = isPresent(dm.outputs) ? ListWrapper.concat(dm.outputs, outputs) : outputs;
var mergedEvents = isPresent(dm.events) ? ListWrapper.concat(dm.events, events) : events;
var mergedHost = isPresent(dm.host) ? StringMapWrapper.merge(dm.host, host) : host; var mergedHost = isPresent(dm.host) ? StringMapWrapper.merge(dm.host, host) : host;
var mergedQueries = var mergedQueries =
isPresent(dm.queries) ? StringMapWrapper.merge(dm.queries, queries) : queries; isPresent(dm.queries) ? StringMapWrapper.merge(dm.queries, queries) : queries;
@ -114,8 +113,8 @@ export class DirectiveResolver {
if (dm instanceof ComponentMetadata) { if (dm instanceof ComponentMetadata) {
return new ComponentMetadata({ return new ComponentMetadata({
selector: dm.selector, selector: dm.selector,
properties: mergedProperties, inputs: mergedInputs,
events: mergedEvents, outputs: mergedOutputs,
host: mergedHost, host: mergedHost,
bindings: dm.bindings, bindings: dm.bindings,
exportAs: dm.exportAs, exportAs: dm.exportAs,
@ -129,8 +128,8 @@ export class DirectiveResolver {
} else { } else {
return new DirectiveMetadata({ return new DirectiveMetadata({
selector: dm.selector, selector: dm.selector,
properties: mergedProperties, inputs: mergedInputs,
events: mergedEvents, outputs: mergedOutputs,
host: mergedHost, host: mergedHost,
bindings: dm.bindings, bindings: dm.bindings,
exportAs: dm.exportAs, exportAs: dm.exportAs,

View File

@ -151,7 +151,8 @@ export class DirectiveBinding extends ResolvedBinding {
} }
get eventEmitters(): string[] { get eventEmitters(): string[] {
return isPresent(this.metadata) && isPresent(this.metadata.events) ? this.metadata.events : []; return isPresent(this.metadata) && isPresent(this.metadata.outputs) ? this.metadata.outputs :
[];
} }
static createFromBinding(binding: Binding, meta: DirectiveMetadata): DirectiveBinding { static createFromBinding(binding: Binding, meta: DirectiveMetadata): DirectiveBinding {
@ -170,9 +171,9 @@ export class DirectiveBinding extends ResolvedBinding {
RenderDirectiveMetadata.DIRECTIVE_TYPE, RenderDirectiveMetadata.DIRECTIVE_TYPE,
selector: meta.selector, selector: meta.selector,
compileChildren: meta.compileChildren, compileChildren: meta.compileChildren,
events: meta.events, outputs: meta.outputs,
host: isPresent(meta.host) ? MapWrapper.createFromStringMap(meta.host) : null, host: isPresent(meta.host) ? MapWrapper.createFromStringMap(meta.host) : null,
properties: meta.properties, inputs: meta.inputs,
readAttributes: DirectiveBinding._readAttributes(<any>deps), readAttributes: DirectiveBinding._readAttributes(<any>deps),
queries: meta.queries, queries: meta.queries,

View File

@ -50,7 +50,7 @@ export var LIFECYCLE_HOOKS_VALUES = [
* propB; * propB;
* *
* onChanges(changes: {[idx: string, PropertyUpdate]}): void { * onChanges(changes: {[idx: string, PropertyUpdate]}): void {
* // This will get called after any of the properties have been updated. * // This will get called after any of the inputs have been updated.
* if (changes['propA']) { * if (changes['propA']) {
* // if propA was updated * // if propA was updated
* } * }

View File

@ -35,7 +35,7 @@ import {
* </div> * </div>
* ``` * ```
*/ */
@Directive({selector: '[ng-class]', properties: ['rawClass: ng-class', 'initialClasses: class']}) @Directive({selector: '[ng-class]', inputs: ['rawClass: ng-class', 'initialClasses: class']})
export class NgClass implements DoCheck, OnDestroy { export class NgClass implements DoCheck, OnDestroy {
private _differ: any; private _differ: any;
private _mode: string; private _mode: string;

View File

@ -39,7 +39,7 @@ import {isPresent, isBlank} from 'angular2/src/core/facade/lang';
* - `<li template="ng-for #item of items; #i = index">...</li>` * - `<li template="ng-for #item of items; #i = index">...</li>`
* - `<template ng-for #item [ng-for-of]="items" #i="index"><li>...</li></template>` * - `<template ng-for #item [ng-for-of]="items" #i="index"><li>...</li></template>`
*/ */
@Directive({selector: '[ng-for][ng-for-of]', properties: ['ngForOf']}) @Directive({selector: '[ng-for][ng-for-of]', inputs: ['ngForOf']})
export class NgFor implements DoCheck { export class NgFor implements DoCheck {
_ngForOf: any; _ngForOf: any;
private _differ: IterableDiffer; private _differ: IterableDiffer;

View File

@ -24,7 +24,7 @@ import {isBlank} from 'angular2/src/core/facade/lang';
* - `<div template="ng-if condition">...</div>` * - `<div template="ng-if condition">...</div>`
* - `<template [ng-if]="condition"><div>...</div></template>` * - `<template [ng-if]="condition"><div>...</div></template>`
*/ */
@Directive({selector: '[ng-if]', properties: ['ngIf']}) @Directive({selector: '[ng-if]', inputs: ['ngIf']})
export class NgIf { export class NgIf {
private _prevCondition: boolean = null; private _prevCondition: boolean = null;

View File

@ -29,7 +29,7 @@ import {isPresent, isBlank, print} from 'angular2/src/core/facade/lang';
* - `<div [ng-style]="{'text-align': alignExp}"></div>` * - `<div [ng-style]="{'text-align': alignExp}"></div>`
* - `<div [ng-style]="styleExp"></div>` * - `<div [ng-style]="styleExp"></div>`
*/ */
@Directive({selector: '[ng-style]', properties: ['rawStyle: ng-style']}) @Directive({selector: '[ng-style]', inputs: ['rawStyle: ng-style']})
export class NgStyle implements DoCheck { export class NgStyle implements DoCheck {
_rawStyle; _rawStyle;
_differ: KeyValueDiffer; _differ: KeyValueDiffer;

View File

@ -39,7 +39,7 @@ export class SwitchView {
* </ANY> * </ANY>
* ``` * ```
*/ */
@Directive({selector: '[ng-switch]', properties: ['ngSwitch']}) @Directive({selector: '[ng-switch]', inputs: ['ngSwitch']})
export class NgSwitch { export class NgSwitch {
private _switchValue: any; private _switchValue: any;
private _useDefault: boolean = false; private _useDefault: boolean = false;
@ -139,7 +139,7 @@ export class NgSwitch {
* <template ng-switch-when="stringValue">...</template> * <template ng-switch-when="stringValue">...</template>
* ``` * ```
*/ */
@Directive({selector: '[ng-switch-when]', properties: ['ngSwitchWhen']}) @Directive({selector: '[ng-switch-when]', inputs: ['ngSwitchWhen']})
export class NgSwitchWhen { export class NgSwitchWhen {
// `_WHEN_DEFAULT` is used as a marker for a not yet initialized value // `_WHEN_DEFAULT` is used as a marker for a not yet initialized value
_value: any = _WHEN_DEFAULT; _value: any = _WHEN_DEFAULT;

View File

@ -91,7 +91,7 @@ export class Observable {
} }
/** /**
* Use by directives and components to emit custom {@link Event}s. * Use by directives and components to emit custom Events.
* *
* ## Examples * ## Examples
* *
@ -109,8 +109,8 @@ export class Observable {
* </div>`}) * </div>`})
* export class Zippy { * export class Zippy {
* visible: boolean = true; * visible: boolean = true;
* @Event() open: EventEmitter = new EventEmitter(); * @Output() open: EventEmitter = new EventEmitter();
* @Event() close: EventEmitter = new EventEmitter(); * @Output() close: EventEmitter = new EventEmitter();
* *
* toggle() { * toggle() {
* this.visible = !this.visible; * this.visible = !this.visible;

View File

@ -53,7 +53,7 @@ const controlGroupBinding =
@Directive({ @Directive({
selector: '[ng-control-group]', selector: '[ng-control-group]',
bindings: [controlGroupBinding], bindings: [controlGroupBinding],
properties: ['name: ng-control-group'], inputs: ['name: ng-control-group'],
exportAs: 'form' exportAs: 'form'
}) })
export class NgControlGroup extends ControlContainer implements OnInit, export class NgControlGroup extends ControlContainer implements OnInit,

View File

@ -75,8 +75,8 @@ const controlNameBinding =
@Directive({ @Directive({
selector: '[ng-control]', selector: '[ng-control]',
bindings: [controlNameBinding], bindings: [controlNameBinding],
properties: ['name: ngControl', 'model: ngModel'], inputs: ['name: ngControl', 'model: ngModel'],
events: ['update: ngModel'], outputs: ['update: ngModel'],
exportAs: 'form' exportAs: 'form'
}) })
export class NgControlName extends NgControl implements OnChanges, export class NgControlName extends NgControl implements OnChanges,

View File

@ -85,7 +85,7 @@ const formDirectiveBinding =
host: { host: {
'(submit)': 'onSubmit()', '(submit)': 'onSubmit()',
}, },
events: ['ngSubmit'], outputs: ['ngSubmit'],
exportAs: 'form' exportAs: 'form'
}) })
export class NgForm extends ControlContainer implements Form { export class NgForm extends ControlContainer implements Form {

View File

@ -65,8 +65,8 @@ const formControlBinding =
@Directive({ @Directive({
selector: '[ng-form-control]', selector: '[ng-form-control]',
bindings: [formControlBinding], bindings: [formControlBinding],
properties: ['form: ngFormControl', 'model: ngModel'], inputs: ['form: ngFormControl', 'model: ngModel'],
events: ['update: ngModel'], outputs: ['update: ngModel'],
exportAs: 'form' exportAs: 'form'
}) })
export class NgFormControl extends NgControl implements OnChanges { export class NgFormControl extends NgControl implements OnChanges {

View File

@ -92,9 +92,9 @@ const formDirectiveBinding =
@Directive({ @Directive({
selector: '[ng-form-model]', selector: '[ng-form-model]',
bindings: [formDirectiveBinding], bindings: [formDirectiveBinding],
properties: ['form: ng-form-model'], inputs: ['form: ng-form-model'],
host: {'(submit)': 'onSubmit()'}, host: {'(submit)': 'onSubmit()'},
events: ['ngSubmit'], outputs: ['ngSubmit'],
exportAs: 'form' exportAs: 'form'
}) })
export class NgFormModel extends ControlContainer implements Form, export class NgFormModel extends ControlContainer implements Form,

View File

@ -36,8 +36,8 @@ const formControlBinding = CONST_EXPR(new Binding(NgControl, {toAlias: forwardRe
@Directive({ @Directive({
selector: '[ng-model]:not([ng-control]):not([ng-form-control])', selector: '[ng-model]:not([ng-control]):not([ng-form-control])',
bindings: [formControlBinding], bindings: [formControlBinding],
properties: ['model: ngModel'], inputs: ['model: ngModel'],
events: ['update: ngModel'], outputs: ['update: ngModel'],
exportAs: 'form' exportAs: 'form'
}) })
export class NgModel extends NgControl implements OnChanges { export class NgModel extends NgControl implements OnChanges {

View File

@ -14,15 +14,15 @@ export './metadata/view.dart';
* See: [DirectiveMetadata] for docs. * See: [DirectiveMetadata] for docs.
*/ */
class Directive extends DirectiveMetadata { class Directive extends DirectiveMetadata {
const Directive({String selector, List<String> properties, const Directive({String selector, List<String> inputs,
List<String> events, Map<String, String> host, List<String> outputs, Map<String, String> host,
List bindings, String exportAs, String moduleId, List bindings, String exportAs, String moduleId,
Map<String, dynamic> queries, Map<String, dynamic> queries,
bool compileChildren: true}) bool compileChildren: true})
: super( : super(
selector: selector, selector: selector,
properties: properties, inputs: inputs,
events: events, outputs: outputs,
host: host, host: host,
bindings: bindings, bindings: bindings,
exportAs: exportAs, exportAs: exportAs,
@ -35,15 +35,15 @@ class Directive extends DirectiveMetadata {
* See: [ComponentMetadata] for docs. * See: [ComponentMetadata] for docs.
*/ */
class Component extends ComponentMetadata { class Component extends ComponentMetadata {
const Component({String selector, List<String> properties, const Component({String selector, List<String> inputs,
List<String> events, Map<String, String> host, List<String> outputs, Map<String, String> host,
List bindings, String exportAs, String moduleId, List bindings, String exportAs, String moduleId,
Map<String, dynamic> queries, Map<String, dynamic> queries,
bool compileChildren, List viewBindings, ChangeDetectionStrategy changeDetection}) bool compileChildren, List viewBindings, ChangeDetectionStrategy changeDetection})
: super( : super(
selector: selector, selector: selector,
properties: properties, inputs: inputs,
events: events, outputs: outputs,
host: host, host: host,
bindings: bindings, bindings: bindings,
exportAs: exportAs, exportAs: exportAs,
@ -134,18 +134,18 @@ class ViewChild extends ViewChildMetadata {
} }
/** /**
* See: [PropertyMetadata] for docs. * See: [InputMetadata] for docs.
*/ */
class Property extends PropertyMetadata { class Input extends InputMetadata {
const Property([String bindingPropertyName]) const Input([String bindingPropertyName])
: super(bindingPropertyName); : super(bindingPropertyName);
} }
/** /**
* See: [EventMetadata] for docs. * See: [OutputMetadata] for docs.
*/ */
class Event extends EventMetadata { class Output extends OutputMetadata {
const Event([String bindingPropertyName]) const Output([String bindingPropertyName])
: super(bindingPropertyName); : super(bindingPropertyName);
} }

View File

@ -17,8 +17,8 @@ export {
ComponentMetadata, ComponentMetadata,
DirectiveMetadata, DirectiveMetadata,
PipeMetadata, PipeMetadata,
PropertyMetadata, InputMetadata,
EventMetadata, OutputMetadata,
HostBindingMetadata, HostBindingMetadata,
HostListenerMetadata HostListenerMetadata
} from './metadata/directives'; } from './metadata/directives';
@ -39,8 +39,8 @@ import {
ComponentMetadata, ComponentMetadata,
DirectiveMetadata, DirectiveMetadata,
PipeMetadata, PipeMetadata,
PropertyMetadata, InputMetadata,
EventMetadata, OutputMetadata,
HostBindingMetadata, HostBindingMetadata,
HostListenerMetadata HostListenerMetadata
} from './metadata/directives'; } from './metadata/directives';
@ -147,8 +147,8 @@ export interface ViewDecorator extends TypeDecorator {
export interface DirectiveFactory { export interface DirectiveFactory {
(obj: { (obj: {
selector?: string, selector?: string,
properties?: string[], inputs?: string[],
events?: string[], outputs?: string[],
host?: StringMap<string, string>, host?: StringMap<string, string>,
bindings?: any[], bindings?: any[],
exportAs?: string, exportAs?: string,
@ -158,8 +158,8 @@ export interface DirectiveFactory {
}): DirectiveDecorator; }): DirectiveDecorator;
new (obj: { new (obj: {
selector?: string, selector?: string,
properties?: string[], inputs?: string[],
events?: string[], outputs?: string[],
host?: StringMap<string, string>, host?: StringMap<string, string>,
bindings?: any[], bindings?: any[],
exportAs?: string, exportAs?: string,
@ -215,8 +215,8 @@ export interface DirectiveFactory {
export interface ComponentFactory { export interface ComponentFactory {
(obj: { (obj: {
selector?: string, selector?: string,
properties?: string[], inputs?: string[],
events?: string[], outputs?: string[],
host?: StringMap<string, string>, host?: StringMap<string, string>,
bindings?: any[], bindings?: any[],
exportAs?: string, exportAs?: string,
@ -228,8 +228,8 @@ export interface ComponentFactory {
}): ComponentDecorator; }): ComponentDecorator;
new (obj: { new (obj: {
selector?: string, selector?: string,
properties?: string[], inputs?: string[],
events?: string[], outputs?: string[],
host?: StringMap<string, string>, host?: StringMap<string, string>,
bindings?: any[], bindings?: any[],
exportAs?: string, exportAs?: string,
@ -452,21 +452,21 @@ export interface PipeFactory {
} }
/** /**
* {@link PropertyMetadata} factory for creating decorators. * {@link InputMetadata} factory for creating decorators.
* *
* See {@link PropertyMetadata}. * See {@link InputMetadata}.
*/ */
export interface PropertyFactory { export interface InputFactory {
(bindingPropertyName?: string): any; (bindingPropertyName?: string): any;
new (bindingPropertyName?: string): any; new (bindingPropertyName?: string): any;
} }
/** /**
* {@link EventMetadata} factory for creating decorators. * {@link OutputMetadata} factory for creating decorators.
* *
* See {@link EventMetadata}. * See {@link OutputMetadata}.
*/ */
export interface EventFactory { export interface OutputFactory {
(bindingPropertyName?: string): any; (bindingPropertyName?: string): any;
new (bindingPropertyName?: string): any; new (bindingPropertyName?: string): any;
} }
@ -567,18 +567,18 @@ export var ViewQuery: QueryFactory = makeParamDecorator(ViewQueryMetadata);
export var Pipe: PipeFactory = <PipeFactory>makeDecorator(PipeMetadata); export var Pipe: PipeFactory = <PipeFactory>makeDecorator(PipeMetadata);
/** /**
* {@link PropertyMetadata} factory function. * {@link InputMetadata} factory function.
* *
* See {@link PropertyMetadata}. * See {@link InputMetadata}.
*/ */
export var Property: PropertyFactory = makePropDecorator(PropertyMetadata); export var Input: InputFactory = makePropDecorator(InputMetadata);
/** /**
* {@link EventMetadata} factory function. * {@link OutputMetadata} factory function.
* *
* See {@link EventMetadata}. * See {@link OutputMetadatas}.
*/ */
export var Event: EventFactory = makePropDecorator(EventMetadata); export var Output: OutputFactory = makePropDecorator(OutputMetadata);
/** /**
* {@link HostBindingMetadata} factory function. * {@link HostBindingMetadata} factory function.

View File

@ -71,7 +71,7 @@ export class AttributeMetadata extends DependencyMetadata {
* ```javascript * ```javascript
* @Component({ * @Component({
* selector: 'pane', * selector: 'pane',
* properties: ['title'] * inputs: ['title']
* }) * })
* @View(...) * @View(...)
* class Pane { * class Pane {

View File

@ -96,7 +96,7 @@ import {ChangeDetectionStrategy} from 'angular2/src/core/change_detection';
* *
* @Directive({ * @Directive({
* selector: '[dependency]', * selector: '[dependency]',
* properties: [ * inputs: [
* 'id: dependency' * 'id: dependency'
* ] * ]
* }) * })
@ -242,7 +242,7 @@ import {ChangeDetectionStrategy} from 'angular2/src/core/change_detection';
* ``` * ```
* @Directive({ * @Directive({
* selector: '[tooltip]', * selector: '[tooltip]',
* properties: [ * inputs: [
* 'text: tooltip' * 'text: tooltip'
* ], * ],
* host: { * host: {
@ -332,7 +332,7 @@ import {ChangeDetectionStrategy} from 'angular2/src/core/change_detection';
* ``` * ```
* @Directive({ * @Directive({
* selector: '[unless]', * selector: '[unless]',
* properties: ['unless'] * inputs: ['unless']
* }) * })
* export class Unless { * export class Unless {
* viewContainer: ViewContainerRef; * viewContainer: ViewContainerRef;
@ -417,11 +417,11 @@ export class DirectiveMetadata extends InjectableMetadata {
selector: string; selector: string;
/** /**
* Enumerates the set of data-bound properties for a directive * Enumerates the set of data-bound input properties for a directive
* *
* Angular automatically updates data-bound properties during change detection. * Angular automatically updates input properties during change detection.
* *
* The `properties` property defines a set of `directiveProperty` to `bindingProperty` * The `inputs` property defines a set of `directiveProperty` to `bindingProperty`
* configuration: * configuration:
* *
* - `directiveProperty` specifies the component property where the value is written. * - `directiveProperty` specifies the component property where the value is written.
@ -436,7 +436,7 @@ export class DirectiveMetadata extends InjectableMetadata {
* ```typescript * ```typescript
* @Component({ * @Component({
* selector: 'bank-account', * selector: 'bank-account',
* properties: ['bankName', 'id: account-id'] * inputs: ['bankName', 'id: account-id']
* }) * })
* @View({ * @View({
* template: ` * template: `
@ -465,15 +465,15 @@ export class DirectiveMetadata extends InjectableMetadata {
* ``` * ```
* *
*/ */
properties: string[]; inputs: string[];
/** /**
* Enumerates the set of event-bound properties. * Enumerates the set of event-bound output properties.
* *
* When an event-bound property emits an event, an event handler attached to that event * When an output property emits an event, an event handler attached to that event
* the template is invoked. * the template is invoked.
* *
* The `events` property defines a set of `directiveProperty` to `bindingProperty` * The `outputs` property defines a set of `directiveProperty` to `bindingProperty`
* configuration: * configuration:
* *
* - `directiveProperty` specifies the component property that emits events. * - `directiveProperty` specifies the component property that emits events.
@ -484,7 +484,7 @@ export class DirectiveMetadata extends InjectableMetadata {
* ```typescript * ```typescript
* @Directive({ * @Directive({
* selector: 'interval-dir', * selector: 'interval-dir',
* events: ['everySecond', 'five5Secs: everyFiveSeconds'] * outputs: ['everySecond', 'five5Secs: everyFiveSeconds']
* }) * })
* class IntervalDir { * class IntervalDir {
* everySecond = new EventEmitter(); * everySecond = new EventEmitter();
@ -512,7 +512,7 @@ export class DirectiveMetadata extends InjectableMetadata {
* ``` * ```
* *
*/ */
events: string[]; outputs: string[];
/** /**
* Specify the events, actions, properties and attributes related to the host element. * Specify the events, actions, properties and attributes related to the host element.
@ -739,12 +739,12 @@ export class DirectiveMetadata extends InjectableMetadata {
queries: StringMap<string, any>; queries: StringMap<string, any>;
constructor({ constructor({
selector, properties, events, host, bindings, exportAs, moduleId, queries, selector, inputs, outputs, host, bindings, exportAs, moduleId, queries,
compileChildren = true, compileChildren = true,
}: { }: {
selector?: string, selector?: string,
properties?: string[], inputs?: string[],
events?: string[], outputs?: string[],
host?: StringMap<string, string>, host?: StringMap<string, string>,
bindings?: any[], bindings?: any[],
exportAs?: string, exportAs?: string,
@ -754,8 +754,8 @@ export class DirectiveMetadata extends InjectableMetadata {
} = {}) { } = {}) {
super(); super();
this.selector = selector; this.selector = selector;
this.properties = properties; this.inputs = inputs;
this.events = events; this.outputs = outputs;
this.host = host; this.host = host;
this.exportAs = exportAs; this.exportAs = exportAs;
this.moduleId = moduleId; this.moduleId = moduleId;
@ -861,12 +861,12 @@ export class ComponentMetadata extends DirectiveMetadata {
*/ */
viewBindings: any[]; viewBindings: any[];
constructor({selector, properties, events, host, exportAs, moduleId, bindings, viewBindings, constructor({selector, inputs, outputs, host, exportAs, moduleId, bindings, viewBindings,
changeDetection = ChangeDetectionStrategy.Default, queries, compileChildren = true}: changeDetection = ChangeDetectionStrategy.Default, queries, compileChildren = true}:
{ {
selector?: string, selector?: string,
properties?: string[], inputs?: string[],
events?: string[], outputs?: string[],
host?: StringMap<string, string>, host?: StringMap<string, string>,
bindings?: any[], bindings?: any[],
exportAs?: string, exportAs?: string,
@ -878,8 +878,8 @@ export class ComponentMetadata extends DirectiveMetadata {
} = {}) { } = {}) {
super({ super({
selector: selector, selector: selector,
properties: properties, inputs: inputs,
events: events, outputs: outputs,
host: host, host: host,
exportAs: exportAs, exportAs: exportAs,
moduleId: moduleId, moduleId: moduleId,
@ -922,17 +922,17 @@ export class PipeMetadata extends InjectableMetadata {
} }
/** /**
* Declares a data-bound property. * Declares a data-bound input property.
* *
* Angular automatically updates data-bound properties during change detection. * Angular automatically updates data-bound properties during change detection.
* *
* `PropertyMetadata` takes an optional parameters that specifies that name * `InputMetadata` takes an optional parameters that specifies that name
* used when instantiating a component in the template. When not provided, * used when instantiating a component in the template. When not provided,
* the class property name is used. * the class property name is used.
* *
* ### Example * ### Example
* *
* The following example creates a component with two data-bound properties. * The following example creates a component with two input properties.
* *
* ```typescript * ```typescript
* @Component({selector: 'bank-account'}) * @Component({selector: 'bank-account'})
@ -943,8 +943,8 @@ export class PipeMetadata extends InjectableMetadata {
* ` * `
* }) * })
* class BankAccount { * class BankAccount {
* @Property() bankName: string; * @Input() bankName: string;
* @Property('account-id') id: string; * @Input('account-id') id: string;
* *
* // this property is not bound, and won't be automatically updated by Angular * // this property is not bound, and won't be automatically updated by Angular
* normalizedBankName: string; * normalizedBankName: string;
@ -963,7 +963,7 @@ export class PipeMetadata extends InjectableMetadata {
* ``` * ```
*/ */
@CONST() @CONST()
export class PropertyMetadata { export class InputMetadata {
constructor( constructor(
/** /**
* Name used when instantiating a component in the temlate. * Name used when instantiating a component in the temlate.
@ -972,12 +972,12 @@ export class PropertyMetadata {
} }
/** /**
* Declares an event-bound property. * Declares an event-bound output property.
* *
* When an event-bound property emits an event, an event handler attached to that event * When an output property emits an event, an event handler attached to that event
* the template is invoked. * the template is invoked.
* *
* `EventMetadata` takes an optional parameters that specifies that name * `OutputMetadata` takes an optional parameters that specifies that name
* used when instantiating a component in the template. When not provided, * used when instantiating a component in the template. When not provided,
* the class property name is used. * the class property name is used.
* *
@ -988,8 +988,8 @@ export class PropertyMetadata {
* selector: 'interval-dir', * selector: 'interval-dir',
* }) * })
* class IntervalDir { * class IntervalDir {
* @Event() everySecond = new EventEmitter(); * @Output() everySecond = new EventEmitter();
* @Event('everyFiveSeconds') five5Secs = new EventEmitter(); * @Output('everyFiveSeconds') five5Secs = new EventEmitter();
* *
* constructor() { * constructor() {
* setInterval(() => this.everySecond.next("event"), 1000); * setInterval(() => this.everySecond.next("event"), 1000);
@ -1013,7 +1013,7 @@ export class PropertyMetadata {
* ``` * ```
*/ */
@CONST() @CONST()
export class EventMetadata { export class OutputMetadata {
constructor(public bindingPropertyName?: string) {} constructor(public bindingPropertyName?: string) {}
} }

View File

@ -143,8 +143,8 @@ export class RenderDirectiveMetadata {
id: any; id: any;
selector: string; selector: string;
compileChildren: boolean; compileChildren: boolean;
events: string[]; outputs: string[];
properties: string[]; inputs: string[];
readAttributes: string[]; readAttributes: string[];
type: number; type: number;
callOnDestroy: boolean; callOnDestroy: boolean;
@ -165,18 +165,18 @@ export class RenderDirectiveMetadata {
// group 2: "event" from "(event)" // group 2: "event" from "(event)"
private static _hostRegExp = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g; private static _hostRegExp = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g;
constructor({id, selector, compileChildren, events, hostListeners, hostProperties, hostAttributes, constructor({id, selector, compileChildren, outputs, hostListeners, hostProperties,
properties, readAttributes, type, callOnDestroy, callOnChanges, callDoCheck, hostAttributes, inputs, readAttributes, type, callOnDestroy, callOnChanges,
callOnInit, callAfterContentInit, callAfterContentChecked, callAfterViewInit, callDoCheck, callOnInit, callAfterContentInit, callAfterContentChecked,
callAfterViewChecked, changeDetection, exportAs, queries}: { callAfterViewInit, callAfterViewChecked, changeDetection, exportAs, queries}: {
id?: string, id?: string,
selector?: string, selector?: string,
compileChildren?: boolean, compileChildren?: boolean,
events?: string[], outputs?: string[],
hostListeners?: Map<string, string>, hostListeners?: Map<string, string>,
hostProperties?: Map<string, string>, hostProperties?: Map<string, string>,
hostAttributes?: Map<string, string>, hostAttributes?: Map<string, string>,
properties?: string[], inputs?: string[],
readAttributes?: string[], readAttributes?: string[],
type?: number, type?: number,
callOnDestroy?: boolean, callOnDestroy?: boolean,
@ -194,11 +194,11 @@ export class RenderDirectiveMetadata {
this.id = id; this.id = id;
this.selector = selector; this.selector = selector;
this.compileChildren = isPresent(compileChildren) ? compileChildren : true; this.compileChildren = isPresent(compileChildren) ? compileChildren : true;
this.events = events; this.outputs = outputs;
this.hostListeners = hostListeners; this.hostListeners = hostListeners;
this.hostAttributes = hostAttributes; this.hostAttributes = hostAttributes;
this.hostProperties = hostProperties; this.hostProperties = hostProperties;
this.properties = properties; this.inputs = inputs;
this.readAttributes = readAttributes; this.readAttributes = readAttributes;
this.type = type; this.type = type;
this.callOnDestroy = callOnDestroy; this.callOnDestroy = callOnDestroy;
@ -214,16 +214,16 @@ export class RenderDirectiveMetadata {
this.queries = queries; this.queries = queries;
} }
static create({id, selector, compileChildren, events, host, properties, readAttributes, type, static create({id, selector, compileChildren, outputs, host, inputs, readAttributes, type,
callOnDestroy, callOnChanges, callDoCheck, callOnInit, callAfterContentInit, callOnDestroy, callOnChanges, callDoCheck, callOnInit, callAfterContentInit,
callAfterContentChecked, callAfterViewInit, callAfterViewChecked, changeDetection, callAfterContentChecked, callAfterViewInit, callAfterViewChecked, changeDetection,
exportAs, queries}: { exportAs, queries}: {
id?: string, id?: string,
selector?: string, selector?: string,
compileChildren?: boolean, compileChildren?: boolean,
events?: string[], outputs?: string[],
host?: Map<string, string>, host?: Map<string, string>,
properties?: string[], inputs?: string[],
readAttributes?: string[], readAttributes?: string[],
type?: number, type?: number,
callOnDestroy?: boolean, callOnDestroy?: boolean,
@ -259,11 +259,11 @@ export class RenderDirectiveMetadata {
id: id, id: id,
selector: selector, selector: selector,
compileChildren: compileChildren, compileChildren: compileChildren,
events: events, outputs: outputs,
hostListeners: hostListeners, hostListeners: hostListeners,
hostProperties: hostProperties, hostProperties: hostProperties,
hostAttributes: hostAttributes, hostAttributes: hostAttributes,
properties: properties, inputs: inputs,
readAttributes: readAttributes, readAttributes: readAttributes,
type: type, type: type,
callOnDestroy: callOnDestroy, callOnDestroy: callOnDestroy,

View File

@ -65,8 +65,8 @@ export class DirectiveParser implements CompileStep {
var dirMetadata = this._directives[directiveIndex]; var dirMetadata = this._directives[directiveIndex];
var directiveBinderBuilder = elementBinder.bindDirective(directiveIndex); var directiveBinderBuilder = elementBinder.bindDirective(directiveIndex);
current.compileChildren = current.compileChildren && dirMetadata.compileChildren; current.compileChildren = current.compileChildren && dirMetadata.compileChildren;
if (isPresent(dirMetadata.properties)) { if (isPresent(dirMetadata.inputs)) {
ListWrapper.forEach(dirMetadata.properties, (bindConfig) => { ListWrapper.forEach(dirMetadata.inputs, (bindConfig) => {
this._bindDirectiveProperty(bindConfig, current, directiveBinderBuilder); this._bindDirectiveProperty(bindConfig, current, directiveBinderBuilder);
}); });
} }

View File

@ -26,8 +26,8 @@ export class MockDirectiveResolver extends DirectiveResolver {
return new ComponentMetadata({ return new ComponentMetadata({
selector: dm.selector, selector: dm.selector,
properties: dm.properties, inputs: dm.inputs,
events: dm.events, outputs: dm.outputs,
host: dm.host, host: dm.host,
bindings: bindings, bindings: bindings,
exportAs: dm.exportAs, exportAs: dm.exportAs,
@ -41,8 +41,8 @@ export class MockDirectiveResolver extends DirectiveResolver {
return new DirectiveMetadata({ return new DirectiveMetadata({
selector: dm.selector, selector: dm.selector,
properties: dm.properties, inputs: dm.inputs,
events: dm.events, outputs: dm.outputs,
host: dm.host, host: dm.host,
bindings: bindings, bindings: bindings,
exportAs: dm.exportAs, exportAs: dm.exportAs,

View File

@ -36,7 +36,7 @@ import {Instruction, stringifyInstruction} from './instruction';
*/ */
@Directive({ @Directive({
selector: '[router-link]', selector: '[router-link]',
properties: ['routeParams: routerLink'], inputs: ['routeParams: routerLink'],
host: { host: {
'(click)': 'onClick()', '(click)': 'onClick()',
'[attr.href]': 'visibleHref', '[attr.href]': 'visibleHref',

View File

@ -367,8 +367,8 @@ export class Serializer {
'id': meta.id, 'id': meta.id,
'selector': meta.selector, 'selector': meta.selector,
'compileChildren': meta.compileChildren, 'compileChildren': meta.compileChildren,
'events': meta.events, 'events': meta.outputs,
'properties': meta.properties, 'inputs': meta.inputs,
'readAttributes': meta.readAttributes, 'readAttributes': meta.readAttributes,
'type': meta.type, 'type': meta.type,
'callOnDestroy': meta.callOnDestroy, 'callOnDestroy': meta.callOnDestroy,
@ -392,7 +392,7 @@ export class Serializer {
hostProperties: this.objectToMap(obj['hostProperties']), hostProperties: this.objectToMap(obj['hostProperties']),
hostListeners: this.objectToMap(obj['hostListeners']), hostListeners: this.objectToMap(obj['hostListeners']),
hostAttributes: this.objectToMap(obj['hostAttributes']), hostAttributes: this.objectToMap(obj['hostAttributes']),
properties: obj['properties'], inputs: obj['inputs'],
readAttributes: obj['readAttributes'], readAttributes: obj['readAttributes'],
type: obj['type'], type: obj['type'],
exportAs: obj['exportAs'], exportAs: obj['exportAs'],
@ -402,7 +402,7 @@ export class Serializer {
callOnInit: obj['callOnInit'], callOnInit: obj['callOnInit'],
callAfterContentChecked: obj['callAfterContentChecked'], callAfterContentChecked: obj['callAfterContentChecked'],
changeDetection: obj['changeDetection'], changeDetection: obj['changeDetection'],
events: obj['events'] outputs: obj['events']
}); });
} }
} }

View File

@ -116,7 +116,7 @@ export function main() {
var dirMeta = CompileDirectiveMetadata.create({ var dirMeta = CompileDirectiveMetadata.create({
type: new CompileTypeMetadata({name: 'SomeDir'}), type: new CompileTypeMetadata({name: 'SomeDir'}),
selector: '[dir-prop]', selector: '[dir-prop]',
properties: ['dirProp'] inputs: ['dirProp']
}); });
var changeDetector = createChangeDetector('<div [dir-prop]="someProp">', [dirMeta], 0); var changeDetector = createChangeDetector('<div [dir-prop]="someProp">', [dirMeta], 0);
@ -130,7 +130,7 @@ export function main() {
var dirMeta = CompileDirectiveMetadata.create({ var dirMeta = CompileDirectiveMetadata.create({
type: new CompileTypeMetadata({name: 'SomeDir'}), type: new CompileTypeMetadata({name: 'SomeDir'}),
selector: '[dir-prop]', selector: '[dir-prop]',
properties: ['dirProp'] inputs: ['dirProp']
}); });
var changeDetector = createChangeDetector('<template [dir-prop]="someProp">', [dirMeta], 0); var changeDetector = createChangeDetector('<template [dir-prop]="someProp">', [dirMeta], 0);

View File

@ -43,8 +43,8 @@ export function main() {
dynamicLoadable: true, dynamicLoadable: true,
type: fullTypeMeta, template: fullTemplateMeta, type: fullTypeMeta, template: fullTemplateMeta,
changeDetection: ChangeDetectionStrategy.Default, changeDetection: ChangeDetectionStrategy.Default,
properties: ['someProp'], inputs: ['someProp'],
events: ['someEvent'], outputs: ['someEvent'],
host: {'(event1)': 'handler1', '[prop1]': 'expr1', 'attr1': 'attrValue2'}, host: {'(event1)': 'handler1', '[prop1]': 'expr1', 'attr1': 'attrValue2'},
lifecycleHooks: [LifecycleHooks.OnChanges] lifecycleHooks: [LifecycleHooks.OnChanges]
}); });

View File

@ -53,8 +53,8 @@ export function main() {
expect(meta.type.moduleId).toEqual('someModuleId'); expect(meta.type.moduleId).toEqual('someModuleId');
expect(meta.lifecycleHooks).toEqual(LIFECYCLE_HOOKS_VALUES); expect(meta.lifecycleHooks).toEqual(LIFECYCLE_HOOKS_VALUES);
expect(meta.changeDetection).toBe(ChangeDetectionStrategy.CheckAlways); expect(meta.changeDetection).toBe(ChangeDetectionStrategy.CheckAlways);
expect(meta.properties).toEqual({'someProp': 'someProp'}); expect(meta.inputs).toEqual({'someProp': 'someProp'});
expect(meta.events).toEqual({'someEvent': 'someEvent'}); expect(meta.outputs).toEqual({'someEvent': 'someEvent'});
expect(meta.hostListeners).toEqual({'someHostListener': 'someHostListenerExpr'}); expect(meta.hostListeners).toEqual({'someHostListener': 'someHostListenerExpr'});
expect(meta.hostProperties).toEqual({'someHostProp': 'someHostPropExpr'}); expect(meta.hostProperties).toEqual({'someHostProp': 'someHostPropExpr'});
expect(meta.hostAttributes).toEqual({'someHostAttr': 'someHostAttrValue'}); expect(meta.hostAttributes).toEqual({'someHostAttr': 'someHostAttrValue'});
@ -94,8 +94,8 @@ class DirectiveWithoutModuleId {
@Component({ @Component({
selector: 'someSelector', selector: 'someSelector',
properties: ['someProp'], inputs: ['someProp'],
events: ['someEvent'], outputs: ['someEvent'],
host: { host: {
'[someHostProp]': 'someHostPropExpr', '[someHostProp]': 'someHostPropExpr',
'(someHostListener)': 'someHostListenerExpr', '(someHostListener)': 'someHostListenerExpr',

View File

@ -246,8 +246,8 @@ export function main() {
expect(normMeta.selector).toEqual(meta.selector); expect(normMeta.selector).toEqual(meta.selector);
expect(normMeta.exportAs).toEqual(meta.exportAs); expect(normMeta.exportAs).toEqual(meta.exportAs);
expect(normMeta.changeDetection).toEqual(meta.changeDetection); expect(normMeta.changeDetection).toEqual(meta.changeDetection);
expect(normMeta.properties).toEqual(meta.properties); expect(normMeta.inputs).toEqual(meta.inputs);
expect(normMeta.events).toEqual(meta.events); expect(normMeta.outputs).toEqual(meta.outputs);
expect(normMeta.hostListeners).toEqual(meta.hostListeners); expect(normMeta.hostListeners).toEqual(meta.hostListeners);
expect(normMeta.hostProperties).toEqual(meta.hostProperties); expect(normMeta.hostProperties).toEqual(meta.hostProperties);
expect(normMeta.hostAttributes).toEqual(meta.hostAttributes); expect(normMeta.hostAttributes).toEqual(meta.hostAttributes);

View File

@ -58,11 +58,8 @@ export function main() {
beforeEach(inject([TemplateParser], (_parser) => { beforeEach(inject([TemplateParser], (_parser) => {
parser = _parser; parser = _parser;
ngIf = CompileDirectiveMetadata.create({ ngIf = CompileDirectiveMetadata.create(
selector: '[ng-if]', {selector: '[ng-if]', type: new CompileTypeMetadata({name: 'NgIf'}), inputs: ['ngIf']});
type: new CompileTypeMetadata({name: 'NgIf'}),
properties: ['ngIf']
});
})); }));
function parse(template: string, directives: CompileDirectiveMetadata[]): TemplateAst[] { function parse(template: string, directives: CompileDirectiveMetadata[]): TemplateAst[] {
@ -415,11 +412,8 @@ export function main() {
}); });
it('should parse directive properties', () => { it('should parse directive properties', () => {
var dirA = CompileDirectiveMetadata.create({ var dirA = CompileDirectiveMetadata.create(
selector: 'div', {selector: 'div', type: new CompileTypeMetadata({name: 'DirA'}), inputs: ['aProp']});
type: new CompileTypeMetadata({name: 'DirA'}),
properties: ['aProp']
});
expect(humanizeTemplateAsts(parse('<div [a-prop]="expr"></div>', [dirA]))) expect(humanizeTemplateAsts(parse('<div [a-prop]="expr"></div>', [dirA])))
.toEqual([ .toEqual([
[ElementAst, 'div', 'TestComp > div:nth-child(0)'], [ElementAst, 'div', 'TestComp > div:nth-child(0)'],
@ -434,11 +428,8 @@ export function main() {
}); });
it('should parse renamed directive properties', () => { it('should parse renamed directive properties', () => {
var dirA = CompileDirectiveMetadata.create({ var dirA = CompileDirectiveMetadata.create(
selector: 'div', {selector: 'div', type: new CompileTypeMetadata({name: 'DirA'}), inputs: ['b:a']});
type: new CompileTypeMetadata({name: 'DirA'}),
properties: ['b:a']
});
expect(humanizeTemplateAsts(parse('<div [a]="expr"></div>', [dirA]))) expect(humanizeTemplateAsts(parse('<div [a]="expr"></div>', [dirA])))
.toEqual([ .toEqual([
[ElementAst, 'div', 'TestComp > div:nth-child(0)'], [ElementAst, 'div', 'TestComp > div:nth-child(0)'],
@ -449,7 +440,7 @@ export function main() {
it('should parse literal directive properties', () => { it('should parse literal directive properties', () => {
var dirA = CompileDirectiveMetadata.create( var dirA = CompileDirectiveMetadata.create(
{selector: 'div', type: new CompileTypeMetadata({name: 'DirA'}), properties: ['a']}); {selector: 'div', type: new CompileTypeMetadata({name: 'DirA'}), inputs: ['a']});
expect(humanizeTemplateAsts(parse('<div a="literal"></div>', [dirA]))) expect(humanizeTemplateAsts(parse('<div a="literal"></div>', [dirA])))
.toEqual([ .toEqual([
[ElementAst, 'div', 'TestComp > div:nth-child(0)'], [ElementAst, 'div', 'TestComp > div:nth-child(0)'],
@ -466,7 +457,7 @@ export function main() {
it('should favor explicit bound properties over literal properties', () => { it('should favor explicit bound properties over literal properties', () => {
var dirA = CompileDirectiveMetadata.create( var dirA = CompileDirectiveMetadata.create(
{selector: 'div', type: new CompileTypeMetadata({name: 'DirA'}), properties: ['a']}); {selector: 'div', type: new CompileTypeMetadata({name: 'DirA'}), inputs: ['a']});
expect(humanizeTemplateAsts(parse('<div a="literal" [a]="\'literal2\'"></div>', [dirA]))) expect(humanizeTemplateAsts(parse('<div a="literal" [a]="\'literal2\'"></div>', [dirA])))
.toEqual([ .toEqual([
[ElementAst, 'div', 'TestComp > div:nth-child(0)'], [ElementAst, 'div', 'TestComp > div:nth-child(0)'],
@ -483,7 +474,7 @@ export function main() {
it('should support optional directive properties', () => { it('should support optional directive properties', () => {
var dirA = CompileDirectiveMetadata.create( var dirA = CompileDirectiveMetadata.create(
{selector: 'div', type: new CompileTypeMetadata({name: 'DirA'}), properties: ['a']}); {selector: 'div', type: new CompileTypeMetadata({name: 'DirA'}), inputs: ['a']});
expect(humanizeTemplateAsts(parse('<div></div>', [dirA]))) expect(humanizeTemplateAsts(parse('<div></div>', [dirA])))
.toEqual([ .toEqual([
[ElementAst, 'div', 'TestComp > div:nth-child(0)'], [ElementAst, 'div', 'TestComp > div:nth-child(0)'],
@ -621,11 +612,8 @@ There is no directive with "exportAs" set to "dirA" at TestComp > div:nth-child(
describe('directives', () => { describe('directives', () => {
it('should locate directives in property bindings', () => { it('should locate directives in property bindings', () => {
var dirA = CompileDirectiveMetadata.create({ var dirA = CompileDirectiveMetadata.create(
selector: '[a=b]', {selector: '[a=b]', type: new CompileTypeMetadata({name: 'DirA'}), inputs: ['a']});
type: new CompileTypeMetadata({name: 'DirA'}),
properties: ['a']
});
var dirB = CompileDirectiveMetadata.create( var dirB = CompileDirectiveMetadata.create(
{selector: '[b]', type: new CompileTypeMetadata({name: 'DirB'})}); {selector: '[b]', type: new CompileTypeMetadata({name: 'DirB'})});
expect(humanizeTemplateAsts(parse('<div template="a b" b>', [dirA, dirB]))) expect(humanizeTemplateAsts(parse('<div template="a b" b>', [dirA, dirB])))
@ -791,7 +779,7 @@ Parser Error: Unexpected token 'b' at column 3 in [a b] in TestComp > div:nth-ch
var dirA = CompileDirectiveMetadata.create({ var dirA = CompileDirectiveMetadata.create({
selector: 'div', selector: 'div',
type: new CompileTypeMetadata({name: 'DirA'}), type: new CompileTypeMetadata({name: 'DirA'}),
properties: ['invalidProp'] inputs: ['invalidProp']
}); });
expect(() => parse('<div [invalid-prop]></div>', [dirA])).not.toThrow(); expect(() => parse('<div [invalid-prop]></div>', [dirA])).not.toThrow();
}); });
@ -957,8 +945,8 @@ class TemplateHumanizer implements TemplateAstVisitor {
visitElement(ast: ElementAst, context: any): any { visitElement(ast: ElementAst, context: any): any {
this.result.push([ElementAst, ast.name, ast.sourceInfo]); this.result.push([ElementAst, ast.name, ast.sourceInfo]);
templateVisitAll(this, ast.attrs); templateVisitAll(this, ast.attrs);
templateVisitAll(this, ast.properties); templateVisitAll(this, ast.inputs);
templateVisitAll(this, ast.events); templateVisitAll(this, ast.outputs);
templateVisitAll(this, ast.exportAsVars); templateVisitAll(this, ast.exportAsVars);
templateVisitAll(this, ast.directives); templateVisitAll(this, ast.directives);
templateVisitAll(this, ast.children); templateVisitAll(this, ast.children);
@ -1003,7 +991,7 @@ class TemplateHumanizer implements TemplateAstVisitor {
} }
visitDirective(ast: DirectiveAst, context: any): any { visitDirective(ast: DirectiveAst, context: any): any {
this.result.push([DirectiveAst, ast.directive, ast.sourceInfo]); this.result.push([DirectiveAst, ast.directive, ast.sourceInfo]);
templateVisitAll(this, ast.properties); templateVisitAll(this, ast.inputs);
templateVisitAll(this, ast.hostProperties); templateVisitAll(this, ast.hostProperties);
templateVisitAll(this, ast.hostEvents); templateVisitAll(this, ast.hostEvents);
templateVisitAll(this, ast.exportAsVars); templateVisitAll(this, ast.exportAsVars);

View File

@ -276,7 +276,7 @@ export function main() {
it('should set directive.bind', inject([AsyncTestCompleter], (async) => { it('should set directive.bind', inject([AsyncTestCompleter], (async) => {
captureDirective(DirectiveWithBind) captureDirective(DirectiveWithBind)
.then((renderDir) => { .then((renderDir) => {
expect(renderDir.properties).toEqual(['a: b']); expect(renderDir.inputs).toEqual(['a: b']);
async.done(); async.done();
}); });
})); }));
@ -685,7 +685,7 @@ class DirectiveWithEvents {
class DirectiveWithProperties { class DirectiveWithProperties {
} }
@Directive({properties: ['a: b']}) @Directive({inputs: ['a: b']})
class DirectiveWithBind { class DirectiveWithBind {
} }

View File

@ -3,8 +3,8 @@ import {DirectiveResolver} from 'angular2/src/core/compiler/directive_resolver';
import { import {
DirectiveMetadata, DirectiveMetadata,
Directive, Directive,
Property, Input,
Event, Output,
HostBinding, HostBinding,
HostListener, HostListener,
ContentChildren, ContentChildren,
@ -25,31 +25,31 @@ class SomeDirective {
class SomeChildDirective extends SomeDirective { class SomeChildDirective extends SomeDirective {
} }
@Directive({selector: 'someDirective', properties: ['c']}) @Directive({selector: 'someDirective', inputs: ['c']})
class SomeDirectiveWithProperties { class SomeDirectiveWithProperties {
@Property() a; @Input() a;
@Property("renamed") b; @Input("renamed") b;
c; c;
} }
@Directive({selector: 'someDirective', events: ['c']}) @Directive({selector: 'someDirective', outputs: ['c']})
class SomeDirectiveWithEvents { class SomeDirectiveWithOutputs {
@Event() a; @Output() a;
@Event("renamed") b; @Output("renamed") b;
c; c;
} }
@Directive({selector: 'someDirective'}) @Directive({selector: 'someDirective'})
class SomeDirectiveWithSetterProps { class SomeDirectiveWithSetterProps {
@Property("renamed") @Input("renamed")
set a(value) { set a(value) {
} }
} }
@Directive({selector: 'someDirective'}) @Directive({selector: 'someDirective'})
class SomeDirectiveWithGetterEvents { class SomeDirectiveWithGetterOutputs {
@Event("renamed") @Output("renamed")
get a() { get a() {
return null; return null;
} }
@ -108,7 +108,7 @@ export function main() {
var directiveMetadata = resolver.resolve(SomeDirective); var directiveMetadata = resolver.resolve(SomeDirective);
expect(directiveMetadata) expect(directiveMetadata)
.toEqual(new DirectiveMetadata( .toEqual(new DirectiveMetadata(
{selector: 'someDirective', properties: [], events: [], host: {}, queries: {}})); {selector: 'someDirective', inputs: [], outputs: [], host: {}, queries: {}}));
}); });
it('should throw if not matching metadata is found', () => { it('should throw if not matching metadata is found', () => {
@ -120,30 +120,30 @@ export function main() {
var directiveMetadata = resolver.resolve(SomeChildDirective); var directiveMetadata = resolver.resolve(SomeChildDirective);
expect(directiveMetadata) expect(directiveMetadata)
.toEqual(new DirectiveMetadata( .toEqual(new DirectiveMetadata(
{selector: 'someChildDirective', properties: [], events: [], host: {}, queries: {}})); {selector: 'someChildDirective', inputs: [], outputs: [], host: {}, queries: {}}));
}); });
describe('properties', () => { describe('inputs', () => {
it('should append directive properties', () => { it('should append directive inputs', () => {
var directiveMetadata = resolver.resolve(SomeDirectiveWithProperties); var directiveMetadata = resolver.resolve(SomeDirectiveWithProperties);
expect(directiveMetadata.properties).toEqual(['c', 'a', 'b: renamed']); expect(directiveMetadata.inputs).toEqual(['c', 'a', 'b: renamed']);
}); });
it('should work with getters and setters', () => { it('should work with getters and setters', () => {
var directiveMetadata = resolver.resolve(SomeDirectiveWithSetterProps); var directiveMetadata = resolver.resolve(SomeDirectiveWithSetterProps);
expect(directiveMetadata.properties).toEqual(['a: renamed']); expect(directiveMetadata.inputs).toEqual(['a: renamed']);
}); });
}); });
describe('events', () => { describe('outputs', () => {
it('should append directive events', () => { it('should append directive outputs', () => {
var directiveMetadata = resolver.resolve(SomeDirectiveWithEvents); var directiveMetadata = resolver.resolve(SomeDirectiveWithOutputs);
expect(directiveMetadata.events).toEqual(['c', 'a', 'b: renamed']); expect(directiveMetadata.outputs).toEqual(['c', 'a', 'b: renamed']);
}); });
it('should work with getters and setters', () => { it('should work with getters and setters', () => {
var directiveMetadata = resolver.resolve(SomeDirectiveWithGetterEvents); var directiveMetadata = resolver.resolve(SomeDirectiveWithGetterOutputs);
expect(directiveMetadata.events).toEqual(['a: renamed']); expect(directiveMetadata.outputs).toEqual(['a: renamed']);
}); });
}); });

View File

@ -345,7 +345,7 @@ export function main() {
describe('event emitters', () => { describe('event emitters', () => {
it('should return a list of event accessors', () => { it('should return a list of event accessors', () => {
var binding = DirectiveBinding.createFromType(HasEventEmitter, var binding = DirectiveBinding.createFromType(HasEventEmitter,
new DirectiveMetadata({events: ['emitter']})); new DirectiveMetadata({outputs: ['emitter']}));
var inj = createPei(null, 0, [binding]); var inj = createPei(null, 0, [binding]);
expect(inj.eventEmitterAccessors.length).toEqual(1); expect(inj.eventEmitterAccessors.length).toEqual(1);
@ -357,7 +357,7 @@ export function main() {
it('should allow a different event vs field name', () => { it('should allow a different event vs field name', () => {
var binding = DirectiveBinding.createFromType(HasEventEmitter, var binding = DirectiveBinding.createFromType(HasEventEmitter,
new DirectiveMetadata({events: ['emitter: publicEmitter']})); new DirectiveMetadata({outputs: ['emitter: publicEmitter']}));
var inj = createPei(null, 0, [binding]); var inj = createPei(null, 0, [binding]);
expect(inj.eventEmitterAccessors.length).toEqual(1); expect(inj.eventEmitterAccessors.length).toEqual(1);

View File

@ -266,7 +266,7 @@ class NoPropertyAccess {
@Component( @Component(
selector: 'on-change', selector: 'on-change',
properties: const ['prop']) inputs: const ['prop'])
@View(template: '') @View(template: '')
class OnChangeComponent implements OnChanges { class OnChangeComponent implements OnChanges {
Map changes; Map changes;
@ -281,7 +281,7 @@ class OnChangeComponent implements OnChanges {
@Component( @Component(
selector: 'component-with-observable-list', selector: 'component-with-observable-list',
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
properties: const ['list'], inputs: const ['list'],
bindings: const [ bindings: const [
const Binding(IterableDiffers, const Binding(IterableDiffers,
toValue: const IterableDiffers(const [ toValue: const IterableDiffers(const [

View File

@ -75,8 +75,8 @@ import {
Attribute, Attribute,
Query, Query,
Pipe, Pipe,
Property, Input,
Event, Output,
HostBinding, HostBinding,
HostListener HostListener
} from 'angular2/src/core/metadata'; } from 'angular2/src/core/metadata';
@ -1733,25 +1733,25 @@ class DynamicViewport {
} }
} }
@Directive({selector: '[my-dir]', properties: ['dirProp: elprop'], exportAs: 'mydir'}) @Directive({selector: '[my-dir]', inputs: ['dirProp: elprop'], exportAs: 'mydir'})
@Injectable() @Injectable()
class MyDir { class MyDir {
dirProp: string; dirProp: string;
constructor() { this.dirProp = ''; } constructor() { this.dirProp = ''; }
} }
@Directive({selector: '[title]', properties: ['title']}) @Directive({selector: '[title]', inputs: ['title']})
class DirectiveWithTitle { class DirectiveWithTitle {
title: string; title: string;
} }
@Directive({selector: '[title]', properties: ['title'], host: {'[title]': 'title'}}) @Directive({selector: '[title]', inputs: ['title'], host: {'[title]': 'title'}})
class DirectiveWithTitleAndHostProperty { class DirectiveWithTitleAndHostProperty {
title: string; title: string;
} }
@Component( @Component(
{selector: 'push-cmp', properties: ['prop'], changeDetection: ChangeDetectionStrategy.OnPush}) {selector: 'push-cmp', inputs: ['prop'], changeDetection: ChangeDetectionStrategy.OnPush})
@View({template: '{{field}}'}) @View({template: '{{field}}'})
@Injectable() @Injectable()
class PushCmp { class PushCmp {
@ -1768,7 +1768,7 @@ class PushCmp {
@Component({ @Component({
selector: 'push-cmp-with-ref', selector: 'push-cmp-with-ref',
properties: ['prop'], inputs: ['prop'],
changeDetection: ChangeDetectionStrategy.OnPush changeDetection: ChangeDetectionStrategy.OnPush
}) })
@View({template: '{{field}}'}) @View({template: '{{field}}'})
@ -1828,7 +1828,7 @@ class MyComp {
throwError() { throw 'boom'; } throwError() { throw 'boom'; }
} }
@Component({selector: 'child-cmp', properties: ['dirProp'], viewBindings: [MyService]}) @Component({selector: 'child-cmp', inputs: ['dirProp'], viewBindings: [MyService]})
@View({directives: [MyDir], template: '{{ctxProp}}'}) @View({directives: [MyDir], template: '{{ctxProp}}'})
@Injectable() @Injectable()
class ChildComp { class ChildComp {
@ -1896,7 +1896,7 @@ class DoublePipe implements PipeTransform {
transform(value, args = null) { return `${value}${value}`; } transform(value, args = null) { return `${value}${value}`; }
} }
@Directive({selector: '[emitter]', events: ['event']}) @Directive({selector: '[emitter]', outputs: ['event']})
@Injectable() @Injectable()
class DirectiveEmitingEvent { class DirectiveEmitingEvent {
msg: string; msg: string;
@ -1985,7 +1985,7 @@ class DirectiveListeningDomEventNoPrevent {
onEvent(event) { return true; } onEvent(event) { return true; }
} }
@Directive({selector: '[id]', properties: ['id']}) @Directive({selector: '[id]', inputs: ['id']})
@Injectable() @Injectable()
class IdDir { class IdDir {
id: string; id: string;
@ -2031,7 +2031,7 @@ class ToolbarPart {
constructor(templateRef: TemplateRef) { this.templateRef = templateRef; } constructor(templateRef: TemplateRef) { this.templateRef = templateRef; }
} }
@Directive({selector: '[toolbar-vc]', properties: ['toolbarVc']}) @Directive({selector: '[toolbar-vc]', inputs: ['toolbarVc']})
@Injectable() @Injectable()
class ToolbarViewContainer { class ToolbarViewContainer {
vc: ViewContainerRef; vc: ViewContainerRef;
@ -2059,7 +2059,7 @@ class ToolbarComponent {
} }
} }
@Directive({selector: '[two-way]', properties: ['value: control'], events: ['control']}) @Directive({selector: '[two-way]', inputs: ['value: control'], outputs: ['control']})
@Injectable() @Injectable()
class DirectiveWithTwoWayBinding { class DirectiveWithTwoWayBinding {
control: EventEmitter; control: EventEmitter;
@ -2199,7 +2199,7 @@ class ChildConsumingEventBus {
constructor(@SkipSelf() bus: EventBus) { this.bus = bus; } constructor(@SkipSelf() bus: EventBus) { this.bus = bus; }
} }
@Directive({selector: '[some-impvp]', properties: ['someImpvp']}) @Directive({selector: '[some-impvp]', inputs: ['someImpvp']})
@Injectable() @Injectable()
class SomeImperativeViewport { class SomeImperativeViewport {
view: ViewRef; view: ViewRef;
@ -2256,8 +2256,8 @@ class DirectiveThrowingAnError {
class DirectiveWithPropDecorators { class DirectiveWithPropDecorators {
target; target;
@Property("elProp") dirProp: string; @Input("elProp") dirProp: string;
@Event('elEvent') event = new EventEmitter(); @Output('elEvent') event = new EventEmitter();
@HostBinding("attr.my-attr") myAttr: string; @HostBinding("attr.my-attr") myAttr: string;
@HostListener("click", ["$event.target"]) @HostListener("click", ["$event.target"])

View File

@ -470,7 +470,7 @@ class MainComp {
text: string = ''; text: string = '';
} }
@Component({selector: 'simple', properties: ['stringProp']}) @Component({selector: 'simple', inputs: ['stringProp']})
@View({template: 'SIMPLE(<ng-content></ng-content>)', directives: []}) @View({template: 'SIMPLE(<ng-content></ng-content>)', directives: []})
class Simple { class Simple {
stringProp: string = ''; stringProp: string = '';
@ -570,7 +570,7 @@ class ConditionalTextComponent {
class Tab { class Tab {
} }
@Component({selector: 'tree', properties: ['depth']}) @Component({selector: 'tree', inputs: ['depth']})
@View({ @View({
template: 'TREE({{depth}}:<tree *manual [depth]="depth+1"></tree>)', template: 'TREE({{depth}}:<tree *manual [depth]="depth+1"></tree>)',
directives: [ManualViewportDirective, Tree] directives: [ManualViewportDirective, Tree]

View File

@ -672,7 +672,7 @@ export function main() {
}); });
} }
@Directive({selector: '[text]', properties: ['text'], exportAs: 'textDir'}) @Directive({selector: '[text]', inputs: ['text'], exportAs: 'textDir'})
@Injectable() @Injectable()
class TextDirective { class TextDirective {
text: string; text: string;

View File

@ -36,7 +36,7 @@ class Logger {
add(thing: string) { this.log.push(thing); } add(thing: string) { this.log.push(thing); }
} }
@Directive({selector: '[message]', properties: ['message']}) @Directive({selector: '[message]', inputs: ['message']})
@Injectable() @Injectable()
class MessageDir { class MessageDir {
logger: Logger; logger: Logger;
@ -76,7 +76,7 @@ class ParentComp {
constructor() { this.parentBinding = 'OriginalParent'; } constructor() { this.parentBinding = 'OriginalParent'; }
} }
@Directive({selector: 'custom-emitter', events: ['myevent']}) @Directive({selector: 'custom-emitter', outputs: ['myevent']})
@Injectable() @Injectable()
class CustomEmitter { class CustomEmitter {
myevent: EventEmitter; myevent: EventEmitter;

View File

@ -62,7 +62,7 @@ class LifecycleDir implements DoCheck {
doCheck() { this._log.add("child_doCheck"); } doCheck() { this._log.add("child_doCheck"); }
} }
@Component({selector: "[lifecycle]", properties: ['field']}) @Component({selector: "[lifecycle]", inputs: ['field']})
@View({template: `<div lifecycle-dir></div>`, directives: [LifecycleDir]}) @View({template: `<div lifecycle-dir></div>`, directives: [LifecycleDir]})
class LifecycleCmp implements OnChanges, OnInit, DoCheck, AfterContentInit, AfterContentChecked, class LifecycleCmp implements OnChanges, OnInit, DoCheck, AfterContentInit, AfterContentChecked,
AfterViewInit, AfterViewChecked { AfterViewInit, AfterViewChecked {

View File

@ -216,11 +216,8 @@ var decoratorWithMultipleAttrs = RenderDirectiveMetadata.create({
type: RenderDirectiveMetadata.DIRECTIVE_TYPE type: RenderDirectiveMetadata.DIRECTIVE_TYPE
}); });
var someDirectiveWithProps = RenderDirectiveMetadata.create({ var someDirectiveWithProps = RenderDirectiveMetadata.create(
selector: '[some-decor-props]', {selector: '[some-decor-props]', inputs: ['dirProp: elProp'], readAttributes: ['some-attr']});
properties: ['dirProp: elProp'],
readAttributes: ['some-attr']
});
var someDirectiveWithHostProperties = RenderDirectiveMetadata.create({ var someDirectiveWithHostProperties = RenderDirectiveMetadata.create({
selector: '[some-decor-with-host-props]', selector: '[some-decor-with-host-props]',

View File

@ -156,11 +156,11 @@ var NG_API = [
'Component.bindings', 'Component.bindings',
'Component.changeDetection', 'Component.changeDetection',
'Component.compileChildren', 'Component.compileChildren',
'Component.events', 'Component.outputs',
'Component.exportAs', 'Component.exportAs',
'Component.host', 'Component.host',
'Component.moduleId', 'Component.moduleId',
'Component.properties', 'Component.inputs',
'Component.queries', 'Component.queries',
'Component.selector', 'Component.selector',
'Component.viewBindings', 'Component.viewBindings',
@ -168,11 +168,11 @@ var NG_API = [
'ComponentMetadata.bindings', 'ComponentMetadata.bindings',
'ComponentMetadata.changeDetection', 'ComponentMetadata.changeDetection',
'ComponentMetadata.compileChildren', 'ComponentMetadata.compileChildren',
'ComponentMetadata.events', 'ComponentMetadata.outputs',
'ComponentMetadata.exportAs', 'ComponentMetadata.exportAs',
'ComponentMetadata.host', 'ComponentMetadata.host',
'ComponentMetadata.moduleId', 'ComponentMetadata.moduleId',
'ComponentMetadata.properties', 'ComponentMetadata.inputs',
'ComponentMetadata.queries', 'ComponentMetadata.queries',
'ComponentMetadata.selector', 'ComponentMetadata.selector',
'ComponentMetadata.viewBindings', 'ComponentMetadata.viewBindings',
@ -373,21 +373,21 @@ var NG_API = [
'Directive', 'Directive',
'Directive.bindings', 'Directive.bindings',
'Directive.compileChildren', 'Directive.compileChildren',
'Directive.events', 'Directive.outputs',
'Directive.exportAs', 'Directive.exportAs',
'Directive.host', 'Directive.host',
'Directive.moduleId', 'Directive.moduleId',
'Directive.properties', 'Directive.inputs',
'Directive.queries', 'Directive.queries',
'Directive.selector', 'Directive.selector',
'DirectiveMetadata', 'DirectiveMetadata',
'DirectiveMetadata.bindings', 'DirectiveMetadata.bindings',
'DirectiveMetadata.compileChildren', 'DirectiveMetadata.compileChildren',
'DirectiveMetadata.events', 'DirectiveMetadata.outputs',
'DirectiveMetadata.exportAs', 'DirectiveMetadata.exportAs',
'DirectiveMetadata.host', 'DirectiveMetadata.host',
'DirectiveMetadata.moduleId', 'DirectiveMetadata.moduleId',
'DirectiveMetadata.properties', 'DirectiveMetadata.inputs',
'DirectiveMetadata.queries', 'DirectiveMetadata.queries',
'DirectiveMetadata.selector', 'DirectiveMetadata.selector',
'DirectiveResolver', 'DirectiveResolver',
@ -407,8 +407,8 @@ var NG_API = [
'ElementRef.renderBoundElementIndex=', 'ElementRef.renderBoundElementIndex=',
'ElementRef.renderView', 'ElementRef.renderView',
'ElementRef.renderView=', 'ElementRef.renderView=',
'Event', 'Output',
'Event.bindingPropertyName', 'Output.bindingPropertyName',
'EventEmitter', 'EventEmitter',
'EventEmitter.add():dart', 'EventEmitter.add():dart',
'EventEmitter.addError():dart', 'EventEmitter.addError():dart',
@ -454,8 +454,8 @@ var NG_API = [
'EventEmitter.toSet():dart', 'EventEmitter.toSet():dart',
'EventEmitter.transform():dart', 'EventEmitter.transform():dart',
'EventEmitter.where():dart', 'EventEmitter.where():dart',
'EventMetadata', 'OutputMetadata',
'EventMetadata.bindingPropertyName', 'OutputMetadata.bindingPropertyName',
'ExpressionChangedAfterItHasBeenCheckedException', 'ExpressionChangedAfterItHasBeenCheckedException',
'ExpressionChangedAfterItHasBeenCheckedException.message', 'ExpressionChangedAfterItHasBeenCheckedException.message',
'ExpressionChangedAfterItHasBeenCheckedException.stackTrace', 'ExpressionChangedAfterItHasBeenCheckedException.stackTrace',
@ -790,10 +790,10 @@ var NG_API = [
'PlatformRef.dispose()', 'PlatformRef.dispose()',
'PlatformRef.injector', 'PlatformRef.injector',
'Predicate:dart', 'Predicate:dart',
'Property', 'Input',
'Property.bindingPropertyName', 'Input.bindingPropertyName',
'PropertyMetadata', 'InputMetadata',
'PropertyMetadata.bindingPropertyName', 'InputMetadata.bindingPropertyName',
'ProtoViewRef', 'ProtoViewRef',
'Query', 'Query',
'Query.descendants', 'Query.descendants',
@ -866,8 +866,8 @@ var NG_API = [
'RenderDirectiveMetadata.changeDetection=', 'RenderDirectiveMetadata.changeDetection=',
'RenderDirectiveMetadata.compileChildren', 'RenderDirectiveMetadata.compileChildren',
'RenderDirectiveMetadata.compileChildren=', 'RenderDirectiveMetadata.compileChildren=',
'RenderDirectiveMetadata.events', 'RenderDirectiveMetadata.outputs',
'RenderDirectiveMetadata.events=', 'RenderDirectiveMetadata.outputs=',
'RenderDirectiveMetadata.exportAs', 'RenderDirectiveMetadata.exportAs',
'RenderDirectiveMetadata.exportAs=', 'RenderDirectiveMetadata.exportAs=',
'RenderDirectiveMetadata.hostAttributes', 'RenderDirectiveMetadata.hostAttributes',
@ -878,8 +878,8 @@ var NG_API = [
'RenderDirectiveMetadata.hostProperties=', 'RenderDirectiveMetadata.hostProperties=',
'RenderDirectiveMetadata.id', 'RenderDirectiveMetadata.id',
'RenderDirectiveMetadata.id=', 'RenderDirectiveMetadata.id=',
'RenderDirectiveMetadata.properties', 'RenderDirectiveMetadata.inputs',
'RenderDirectiveMetadata.properties=', 'RenderDirectiveMetadata.inputs=',
'RenderDirectiveMetadata.queries', 'RenderDirectiveMetadata.queries',
'RenderDirectiveMetadata.queries=', 'RenderDirectiveMetadata.queries=',
'RenderDirectiveMetadata.readAttributes', 'RenderDirectiveMetadata.readAttributes',

View File

@ -49,7 +49,7 @@ export class MdButton {
@Component({ @Component({
selector: 'a[md-button], a[md-raised-button], a[md-fab]', selector: 'a[md-button], a[md-raised-button], a[md-fab]',
properties: ['disabled'], inputs: ['disabled'],
host: { host: {
'(click)': 'onClick($event)', '(click)': 'onClick($event)',
'(mousedown)': 'onMousedown()', '(mousedown)': 'onMousedown()',

View File

@ -6,7 +6,7 @@ import {NumberWrapper} from 'angular2/src/core/facade/lang';
@Component({ @Component({
selector: 'md-checkbox', selector: 'md-checkbox',
properties: ['checked', 'disabled'], inputs: ['checked', 'disabled'],
host: { host: {
'role': 'checkbox', 'role': 'checkbox',
'[attr.aria-checked]': 'checked', '[attr.aria-checked]': 'checked',

View File

@ -27,7 +27,7 @@ class RowHeightMode {
} }
@Component({selector: 'md-grid-list', properties: ['cols', 'rowHeight', 'gutterSize']}) @Component({selector: 'md-grid-list', inputs: ['cols', 'rowHeight', 'gutterSize']})
@View({ @View({
templateUrl: 'package:angular2_material/src/components/grid_list/grid_list.html', templateUrl: 'package:angular2_material/src/components/grid_list/grid_list.html',
encapsulation: ViewEncapsulation.None encapsulation: ViewEncapsulation.None
@ -214,7 +214,7 @@ export class MdGridList implements AfterContentChecked {
@Component({ @Component({
selector: 'md-grid-tile', selector: 'md-grid-tile',
properties: ['rowspan', 'colspan'], inputs: ['rowspan', 'colspan'],
host: { host: {
'role': 'listitem', 'role': 'listitem',
'[style.height]': 'style.height', '[style.height]': 'style.height',

View File

@ -65,7 +65,7 @@ export class MdInputContainer implements AfterContentChecked {
@Directive({ @Directive({
selector: 'md-input-container input', selector: 'md-input-container input',
events: ['mdChange', 'mdFocusChange'], outputs: ['mdChange', 'mdFocusChange'],
host: { host: {
'class': 'md-input', 'class': 'md-input',
'(input)': 'updateValue($event)', '(input)': 'updateValue($event)',

View File

@ -21,7 +21,7 @@ class ProgressMode {
@Component({ @Component({
selector: 'md-progress-linear', selector: 'md-progress-linear',
properties: ['value', 'bufferValue'], inputs: ['value', 'bufferValue'],
host: { host: {
'role': 'progressbar', 'role': 'progressbar',
'aria-valuemin': '0', 'aria-valuemin': '0',

View File

@ -35,8 +35,8 @@ var _uniqueIdCounter: number = 0;
@Component({ @Component({
selector: 'md-radio-group', selector: 'md-radio-group',
events: ['change'], outputs: ['change'],
properties: ['disabled', 'value'], inputs: ['disabled', 'value'],
host: { host: {
'role': 'radiogroup', 'role': 'radiogroup',
'[attr.aria-disabled]': 'disabled', '[attr.aria-disabled]': 'disabled',
@ -192,7 +192,7 @@ export class MdRadioGroup implements OnChanges {
@Component({ @Component({
selector: 'md-radio-button', selector: 'md-radio-button',
properties: ['id', 'name', 'value', 'checked', 'disabled'], inputs: ['id', 'name', 'value', 'checked', 'disabled'],
host: { host: {
'role': 'radio', 'role': 'radio',
'[id]': 'id', '[id]': 'id',

View File

@ -6,7 +6,7 @@ import {MdCheckbox} from "../checkbox/checkbox";
@Component({ @Component({
selector: 'md-switch', selector: 'md-switch',
properties: ['checked', 'disabled'], inputs: ['checked', 'disabled'],
host: { host: {
'role': 'checkbox', 'role': 'checkbox',
'[attr.aria-checked]': 'checked', '[attr.aria-checked]': 'checked',

View File

@ -109,26 +109,26 @@ class CompilerAppComponent {
} }
} }
@Directive({selector: '[dir0]', properties: ['prop: attr0']}) @Directive({selector: '[dir0]', inputs: ['prop: attr0']})
class Dir0 { class Dir0 {
} }
@Directive({selector: '[dir1]', properties: ['prop: attr1']}) @Directive({selector: '[dir1]', inputs: ['prop: attr1']})
class Dir1 { class Dir1 {
constructor(dir0: Dir0) {} constructor(dir0: Dir0) {}
} }
@Directive({selector: '[dir2]', properties: ['prop: attr2']}) @Directive({selector: '[dir2]', inputs: ['prop: attr2']})
class Dir2 { class Dir2 {
constructor(dir1: Dir1) {} constructor(dir1: Dir1) {}
} }
@Directive({selector: '[dir3]', properties: ['prop: attr3']}) @Directive({selector: '[dir3]', inputs: ['prop: attr3']})
class Dir3 { class Dir3 {
constructor(dir2: Dir2) {} constructor(dir2: Dir2) {}
} }
@Directive({selector: '[dir4]', properties: ['prop: attr4']}) @Directive({selector: '[dir4]', inputs: ['prop: attr4']})
class Dir4 { class Dir4 {
constructor(dir3: Dir3) {} constructor(dir3: Dir3) {}
} }

View File

@ -219,7 +219,7 @@ class CellData {
iFn() { return this.i; } iFn() { return this.i; }
} }
@Component({selector: 'largetable', properties: ['data', 'benchmarkType']}) @Component({selector: 'largetable', inputs: ['data', 'benchmarkType']})
@View({ @View({
directives: [NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault], directives: [NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault],
template: ` template: `

View File

@ -12,19 +12,19 @@ export class HasStyle {
set width(w: number) { this.cellWidth = w; } set width(w: number) { this.cellWidth = w; }
} }
@Component({selector: 'company-name', properties: ['width: cell-width', 'company']}) @Component({selector: 'company-name', inputs: ['width: cell-width', 'company']})
@View({directives: [], template: `<div [style.width.px]="cellWidth">{{company.name}}</div>`}) @View({directives: [], template: `<div [style.width.px]="cellWidth">{{company.name}}</div>`})
export class CompanyNameComponent extends HasStyle { export class CompanyNameComponent extends HasStyle {
company: Company; company: Company;
} }
@Component({selector: 'opportunity-name', properties: ['width: cell-width', 'opportunity']}) @Component({selector: 'opportunity-name', inputs: ['width: cell-width', 'opportunity']})
@View({directives: [], template: `<div [style.width.px]="cellWidth">{{opportunity.name}}</div>`}) @View({directives: [], template: `<div [style.width.px]="cellWidth">{{opportunity.name}}</div>`})
export class OpportunityNameComponent extends HasStyle { export class OpportunityNameComponent extends HasStyle {
opportunity: Opportunity; opportunity: Opportunity;
} }
@Component({selector: 'offering-name', properties: ['width: cell-width', 'offering']}) @Component({selector: 'offering-name', inputs: ['width: cell-width', 'offering']})
@View({directives: [], template: `<div [style.width.px]="cellWidth">{{offering.name}}</div>`}) @View({directives: [], template: `<div [style.width.px]="cellWidth">{{offering.name}}</div>`})
export class OfferingNameComponent extends HasStyle { export class OfferingNameComponent extends HasStyle {
offering: Offering; offering: Offering;
@ -37,7 +37,7 @@ export class Stage {
apply: Function; apply: Function;
} }
@Component({selector: 'stage-buttons', properties: ['width: cell-width', 'offering']}) @Component({selector: 'stage-buttons', inputs: ['width: cell-width', 'offering']})
@View({ @View({
directives: [NgFor], directives: [NgFor],
template: ` template: `
@ -82,7 +82,7 @@ export class StageButtonsComponent extends HasStyle {
} }
} }
@Component({selector: 'account-cell', properties: ['width: cell-width', 'account']}) @Component({selector: 'account-cell', inputs: ['width: cell-width', 'account']})
@View({ @View({
directives: [], directives: [],
template: ` template: `
@ -96,7 +96,7 @@ export class AccountCellComponent extends HasStyle {
account: Account; account: Account;
} }
@Component({selector: 'formatted-cell', properties: ['width: cell-width', 'value']}) @Component({selector: 'formatted-cell', inputs: ['width: cell-width', 'value']})
@View({directives: [], template: `<div [style.width.px]="cellWidth">{{formattedValue}}</div>`}) @View({directives: [], template: `<div [style.width.px]="cellWidth">{{formattedValue}}</div>`})
export class FormattedCellComponent extends HasStyle { export class FormattedCellComponent extends HasStyle {
formattedValue: string; formattedValue: string;

View File

@ -25,7 +25,7 @@ import {
AAT_STATUS_WIDTH AAT_STATUS_WIDTH
} from './common'; } from './common';
@Component({selector: 'scroll-item', properties: ['offering']}) @Component({selector: 'scroll-item', inputs: ['offering']})
@View({ @View({
directives: [ directives: [
CompanyNameComponent, CompanyNameComponent,

View File

@ -226,12 +226,12 @@ class StaticTreeComponentBase {
get data() { return this._value; } get data() { return this._value; }
} }
@Component({selector: 'tree', properties: ['data']}) @Component({selector: 'tree', inputs: ['data']})
@View({directives: [], template: '<span>{{data.value}} </span>'}) @View({directives: [], template: '<span>{{data.value}} </span>'})
class StaticTreeComponent0 extends StaticTreeComponentBase { class StaticTreeComponent0 extends StaticTreeComponentBase {
} }
@Component({selector: 'tree', properties: ['data']}) @Component({selector: 'tree', inputs: ['data']})
@View({ @View({
directives: [StaticTreeComponent0], directives: [StaticTreeComponent0],
template: template:
@ -240,7 +240,7 @@ class StaticTreeComponent0 extends StaticTreeComponentBase {
class StaticTreeComponent1 extends StaticTreeComponentBase { class StaticTreeComponent1 extends StaticTreeComponentBase {
} }
@Component({selector: 'tree', properties: ['data']}) @Component({selector: 'tree', inputs: ['data']})
@View({ @View({
directives: [StaticTreeComponent1], directives: [StaticTreeComponent1],
template: template:
@ -250,7 +250,7 @@ class StaticTreeComponent2 extends StaticTreeComponentBase {
data: TreeNode; data: TreeNode;
} }
@Component({selector: 'tree', properties: ['data']}) @Component({selector: 'tree', inputs: ['data']})
@View({ @View({
directives: [StaticTreeComponent2], directives: [StaticTreeComponent2],
template: template:
@ -259,7 +259,7 @@ class StaticTreeComponent2 extends StaticTreeComponentBase {
class StaticTreeComponent3 extends StaticTreeComponentBase { class StaticTreeComponent3 extends StaticTreeComponentBase {
} }
@Component({selector: 'tree', properties: ['data']}) @Component({selector: 'tree', inputs: ['data']})
@View({ @View({
directives: [StaticTreeComponent3], directives: [StaticTreeComponent3],
template: template:
@ -268,7 +268,7 @@ class StaticTreeComponent3 extends StaticTreeComponentBase {
class StaticTreeComponent4 extends StaticTreeComponentBase { class StaticTreeComponent4 extends StaticTreeComponentBase {
} }
@Component({selector: 'tree', properties: ['data']}) @Component({selector: 'tree', inputs: ['data']})
@View({ @View({
directives: [StaticTreeComponent4], directives: [StaticTreeComponent4],
template: template:
@ -277,7 +277,7 @@ class StaticTreeComponent4 extends StaticTreeComponentBase {
class StaticTreeComponent5 extends StaticTreeComponentBase { class StaticTreeComponent5 extends StaticTreeComponentBase {
} }
@Component({selector: 'tree', properties: ['data']}) @Component({selector: 'tree', inputs: ['data']})
@View({ @View({
directives: [StaticTreeComponent5], directives: [StaticTreeComponent5],
template: template:
@ -286,7 +286,7 @@ class StaticTreeComponent5 extends StaticTreeComponentBase {
class StaticTreeComponent6 extends StaticTreeComponentBase { class StaticTreeComponent6 extends StaticTreeComponentBase {
} }
@Component({selector: 'tree', properties: ['data']}) @Component({selector: 'tree', inputs: ['data']})
@View({ @View({
directives: [StaticTreeComponent6], directives: [StaticTreeComponent6],
template: template:
@ -295,7 +295,7 @@ class StaticTreeComponent6 extends StaticTreeComponentBase {
class StaticTreeComponent7 extends StaticTreeComponentBase { class StaticTreeComponent7 extends StaticTreeComponentBase {
} }
@Component({selector: 'tree', properties: ['data']}) @Component({selector: 'tree', inputs: ['data']})
@View({ @View({
directives: [StaticTreeComponent7], directives: [StaticTreeComponent7],
template: template:
@ -304,7 +304,7 @@ class StaticTreeComponent7 extends StaticTreeComponentBase {
class StaticTreeComponent8 extends StaticTreeComponentBase { class StaticTreeComponent8 extends StaticTreeComponentBase {
} }
@Component({selector: 'tree', properties: ['data']}) @Component({selector: 'tree', inputs: ['data']})
@View({ @View({
directives: [StaticTreeComponent8], directives: [StaticTreeComponent8],
template: template:

View File

@ -218,7 +218,7 @@ class BaseLineIf {
} }
} }
@Component({selector: 'tree', properties: ['data']}) @Component({selector: 'tree', inputs: ['data']})
@View({ @View({
directives: [TreeComponent, NgIf], directives: [TreeComponent, NgIf],
template: template:

View File

@ -67,7 +67,7 @@ class DemoApp {
@Component({ @Component({
selector: 'simple-dialog', selector: 'simple-dialog',
properties: ['numCoconuts'], inputs: ['numCoconuts'],
}) })
@View({ @View({
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,

View File

@ -41,7 +41,7 @@ function creditCardValidator(c): StringMap<string, boolean> {
* actual error message. * actual error message.
* To make it simple, we are using a simple map here. * To make it simple, we are using a simple map here.
*/ */
@Component({selector: 'show-error', properties: ['controlPath: control', 'errorTypes: errors']}) @Component({selector: 'show-error', inputs: ['controlPath: control', 'errorTypes: errors']})
@View({ @View({
template: ` template: `
<span *ng-if="errorMessage !== null">{{errorMessage}}</span> <span *ng-if="errorMessage !== null">{{errorMessage}}</span>

View File

@ -16,7 +16,7 @@ class HasStyle {
} }
@Component( @Component(
selector: "company-name", selector: "company-name",
properties: const ["width: cell-width", "company"], inputs: const ["width: cell-width", "company"],
changeDetection: ChangeDetectionStrategy.OnPushObserve changeDetection: ChangeDetectionStrategy.OnPushObserve
) )
@View( @View(
@ -28,7 +28,7 @@ class CompanyNameComponent extends HasStyle {
} }
@Component( @Component(
selector: "opportunity-name", selector: "opportunity-name",
properties: const ["width: cell-width", "opportunity"], inputs: const ["width: cell-width", "opportunity"],
changeDetection: ChangeDetectionStrategy.OnPushObserve changeDetection: ChangeDetectionStrategy.OnPushObserve
) )
@View( @View(
@ -40,7 +40,7 @@ class OpportunityNameComponent extends HasStyle {
} }
@Component( @Component(
selector: "offering-name", selector: "offering-name",
properties: const ["width: cell-width", "offering"], inputs: const ["width: cell-width", "offering"],
changeDetection: ChangeDetectionStrategy.OnPushObserve changeDetection: ChangeDetectionStrategy.OnPushObserve
) )
@View( @View(
@ -58,7 +58,7 @@ class Stage {
} }
@Component( @Component(
selector: "stage-buttons", selector: "stage-buttons",
properties: const ["width: cell-width", "offering"], inputs: const ["width: cell-width", "offering"],
changeDetection: ChangeDetectionStrategy.OnPushObserve changeDetection: ChangeDetectionStrategy.OnPushObserve
) )
@View(directives: const [NgFor], template: ''' @View(directives: const [NgFor], template: '''
@ -102,7 +102,7 @@ class StageButtonsComponent extends HasStyle {
} }
@Component( @Component(
selector: "account-cell", selector: "account-cell",
properties: const ["width: cell-width", "account"], inputs: const ["width: cell-width", "account"],
changeDetection: ChangeDetectionStrategy.OnPushObserve changeDetection: ChangeDetectionStrategy.OnPushObserve
) )
@View(directives: const [], template: ''' @View(directives: const [], template: '''
@ -116,7 +116,7 @@ class AccountCellComponent extends HasStyle {
} }
@Component( @Component(
selector: "formatted-cell", selector: "formatted-cell",
properties: const ["width: cell-width", "value"], inputs: const ["width: cell-width", "value"],
changeDetection: ChangeDetectionStrategy.OnPushObserve changeDetection: ChangeDetectionStrategy.OnPushObserve
) )
@View( @View(

View File

@ -25,7 +25,7 @@ import "common.dart"
END_DATE_WIDTH, END_DATE_WIDTH,
AAT_STATUS_WIDTH; AAT_STATUS_WIDTH;
@Component(selector: "scroll-item", properties: const ["offering"], @Component(selector: "scroll-item", inputs: const ["offering"],
changeDetection: ChangeDetectionStrategy.OnPushObserve) changeDetection: ChangeDetectionStrategy.OnPushObserve)
@View( @View(
directives: const [ directives: const [

View File

@ -116,7 +116,7 @@ class OrderListComponent {
} }
@Component({selector: 'order-item-cmp', properties: ['item'], events: ['delete']}) @Component({selector: 'order-item-cmp', inputs: ['item'], outputs: ['delete']})
@View({ @View({
template: ` template: `
<div> <div>

View File

@ -65,7 +65,7 @@ class CreditCardValidator {
* actual error message. * actual error message.
* To make it simple, we are using a simple map here. * To make it simple, we are using a simple map here.
*/ */
@Component({selector: 'show-error', properties: ['controlPath: control', 'errorTypes: errors']}) @Component({selector: 'show-error', inputs: ['controlPath: control', 'errorTypes: errors']})
@View({ @View({
template: ` template: `
<span *ng-if="errorMessage !== null">{{errorMessage}}</span> <span *ng-if="errorMessage !== null">{{errorMessage}}</span>

View File

@ -1,11 +1,8 @@
import {Component, View, EventEmitter} from 'angular2/angular2'; import {Component, View, EventEmitter} from 'angular2/angular2';
import {ObservableWrapper} from 'angular2/src/core/facade/async'; import {ObservableWrapper} from 'angular2/src/core/facade/async';
@Component({ @Component(
selector: 'zippy', {selector: 'zippy', inputs: ['title'], outputs: ['openHandler: open', 'closeHandler: close']})
properties: ['title'],
events: ['openHandler: open', 'closeHandler: close']
})
@View({templateUrl: 'zippy.html'}) @View({templateUrl: 'zippy.html'})
export class Zippy { export class Zippy {
visible: boolean = true; visible: boolean = true;

View File

@ -105,7 +105,7 @@ class Component extends Directive {
injectables = injectables, injectables = injectables,
super( super(
selector: selector, selector: selector,
properties: properties, inputs: properties,
events: events, events: events,
hostListeners: hostListeners, hostListeners: hostListeners,
lifecycle: lifecycle); lifecycle: lifecycle);

View File

@ -123,7 +123,7 @@ List<String> _generateSetters(Map<String, String> bindMap) {
/// the bind properties and the values are either the one and only type /// the bind properties and the values are either the one and only type
/// binding to that property or the empty string. /// binding to that property or the empty string.
Map<String, String> _createPropertiesMap(NgDeps ngDeps) { Map<String, String> _createPropertiesMap(NgDeps ngDeps) {
var visitor = new ExtractNamedExpressionVisitor('properties'); var visitor = new ExtractNamedExpressionVisitor('inputs');
var bindMap = {}; var bindMap = {};
ngDeps.registeredTypes.forEach((RegisteredType t) { ngDeps.registeredTypes.forEach((RegisteredType t) {
visitor.bindConfig.clear(); visitor.bindConfig.clear();
@ -167,7 +167,7 @@ List<String> _generateGetters(List<String> eventProperties) {
/// Collapses all `events` in {@link ngDeps} into a list of corresponding /// Collapses all `events` in {@link ngDeps} into a list of corresponding
/// property names. /// property names.
List<String> _createEventPropertiesList(NgDeps ngDeps) { List<String> _createEventPropertiesList(NgDeps ngDeps) {
var visitor = new ExtractNamedExpressionVisitor('events'); var visitor = new ExtractNamedExpressionVisitor('outputs');
var propertyNames = []; var propertyNames = [];
ngDeps.registeredTypes.forEach((RegisteredType t) { ngDeps.registeredTypes.forEach((RegisteredType t) {
visitor.bindConfig.clear(); visitor.bindConfig.clear();

View File

@ -19,7 +19,7 @@ Map<String, dynamic> directiveMetadataToMap(RenderDirectiveMetadata meta) {
["hostProperties", _cloneIfPresent(meta.hostProperties)], ["hostProperties", _cloneIfPresent(meta.hostProperties)],
["hostListeners", _cloneIfPresent(meta.hostListeners)], ["hostListeners", _cloneIfPresent(meta.hostListeners)],
["hostAttributes", _cloneIfPresent(meta.hostAttributes)], ["hostAttributes", _cloneIfPresent(meta.hostAttributes)],
["properties", _cloneIfPresent(meta.properties)], ["inputs", _cloneIfPresent(meta.inputs)],
["readAttributes", _cloneIfPresent(meta.readAttributes)], ["readAttributes", _cloneIfPresent(meta.readAttributes)],
["type", meta.type], ["type", meta.type],
["exportAs", meta.exportAs], ["exportAs", meta.exportAs],
@ -31,7 +31,7 @@ Map<String, dynamic> directiveMetadataToMap(RenderDirectiveMetadata meta) {
["callAfterContentChecked", meta.callAfterContentChecked], ["callAfterContentChecked", meta.callAfterContentChecked],
["callAfterViewInit", meta.callAfterViewInit], ["callAfterViewInit", meta.callAfterViewInit],
["callAfterViewChecked", meta.callAfterViewChecked], ["callAfterViewChecked", meta.callAfterViewChecked],
["events", meta.events], ["outputs", meta.outputs],
["changeDetection", meta.changeDetection == null ? null : meta.changeDetection.index], ["changeDetection", meta.changeDetection == null ? null : meta.changeDetection.index],
["version", 1] ["version", 1]
]); ]);
@ -52,7 +52,7 @@ RenderDirectiveMetadata directiveMetadataFromMap(Map<String, dynamic> map) {
map["hostListeners"]) as Map<String, String>), map["hostListeners"]) as Map<String, String>),
hostAttributes: (_cloneIfPresent( hostAttributes: (_cloneIfPresent(
map["hostAttributes"]) as Map<String, String>), map["hostAttributes"]) as Map<String, String>),
properties: (_cloneIfPresent(map["properties"]) as List<String>), inputs: (_cloneIfPresent(map["inputs"]) as List<String>),
readAttributes: (_cloneIfPresent(map["readAttributes"]) as List<String>), readAttributes: (_cloneIfPresent(map["readAttributes"]) as List<String>),
type: (map["type"] as num), type: (map["type"] as num),
exportAs: (map["exportAs"] as String), exportAs: (map["exportAs"] as String),
@ -64,7 +64,7 @@ RenderDirectiveMetadata directiveMetadataFromMap(Map<String, dynamic> map) {
callAfterContentChecked: (map["callAfterContentChecked"] as bool), callAfterContentChecked: (map["callAfterContentChecked"] as bool),
callAfterViewInit: (map["callAfterViewInit"] as bool), callAfterViewInit: (map["callAfterViewInit"] as bool),
callAfterViewChecked: (map["callAfterViewChecked"] as bool), callAfterViewChecked: (map["callAfterViewChecked"] as bool),
events: (_cloneIfPresent(map["events"]) as List<String>), outputs: (_cloneIfPresent(map["outputs"]) as List<String>),
changeDetection: map["changeDetection"] == null ? null changeDetection: map["changeDetection"] == null ? null
: ChangeDetectionStrategy.values[map["changeDetection"] as int]); : ChangeDetectionStrategy.values[map["changeDetection"] as int]);
} }

View File

@ -132,7 +132,7 @@ class _DirectiveMetadataVisitor extends Object
num _type; num _type;
String _selector; String _selector;
bool _compileChildren; bool _compileChildren;
List<String> _properties; List<String> _inputs;
Map<String, String> _host; Map<String, String> _host;
List<String> _readAttributes; List<String> _readAttributes;
String _exportAs; String _exportAs;
@ -145,7 +145,7 @@ class _DirectiveMetadataVisitor extends Object
bool _callAfterViewInit; bool _callAfterViewInit;
bool _callAfterViewChecked; bool _callAfterViewChecked;
ChangeDetectionStrategy _changeDetection; ChangeDetectionStrategy _changeDetection;
List<String> _events; List<String> _outputs;
final ConstantEvaluator _evaluator = new ConstantEvaluator(); final ConstantEvaluator _evaluator = new ConstantEvaluator();
@ -155,7 +155,7 @@ class _DirectiveMetadataVisitor extends Object
_type = directiveType; _type = directiveType;
_selector = ''; _selector = '';
_compileChildren = true; _compileChildren = true;
_properties = []; _inputs = [];
_host = {}; _host = {};
_readAttributes = []; _readAttributes = [];
_exportAs = null; _exportAs = null;
@ -168,14 +168,14 @@ class _DirectiveMetadataVisitor extends Object
_callAfterViewInit = false; _callAfterViewInit = false;
_callAfterViewChecked = false; _callAfterViewChecked = false;
_changeDetection = null; _changeDetection = null;
_events = []; _outputs = [];
} }
RenderDirectiveMetadata get meta => RenderDirectiveMetadata.create( RenderDirectiveMetadata get meta => RenderDirectiveMetadata.create(
type: _type, type: _type,
selector: _selector, selector: _selector,
compileChildren: _compileChildren, compileChildren: _compileChildren,
properties: _properties, inputs: _inputs,
host: _host, host: _host,
readAttributes: _readAttributes, readAttributes: _readAttributes,
exportAs: _exportAs, exportAs: _exportAs,
@ -188,7 +188,7 @@ class _DirectiveMetadataVisitor extends Object
callAfterViewInit: _callAfterViewInit, callAfterViewInit: _callAfterViewInit,
callAfterViewChecked: _callAfterViewChecked, callAfterViewChecked: _callAfterViewChecked,
changeDetection: _changeDetection, changeDetection: _changeDetection,
events: _events); outputs: _outputs);
@override @override
Object visitAnnotation(Annotation node) { Object visitAnnotation(Annotation node) {
@ -223,7 +223,7 @@ class _DirectiveMetadataVisitor extends Object
case 'compileChildren': case 'compileChildren':
_populateCompileChildren(node.expression); _populateCompileChildren(node.expression);
break; break;
case 'properties': case 'inputs':
_populateProperties(node.expression); _populateProperties(node.expression);
break; break;
case 'host': case 'host':
@ -235,7 +235,7 @@ class _DirectiveMetadataVisitor extends Object
case 'changeDetection': case 'changeDetection':
_populateChangeDetection(node.expression); _populateChangeDetection(node.expression);
break; break;
case 'events': case 'outputs':
_populateEvents(node.expression); _populateEvents(node.expression);
break; break;
} }
@ -312,7 +312,7 @@ class _DirectiveMetadataVisitor extends Object
void _populateProperties(Expression propertiesValue) { void _populateProperties(Expression propertiesValue) {
_checkMeta(); _checkMeta();
_populateList(propertiesValue, _properties, 'Directive#properties'); _populateList(propertiesValue, _inputs, 'Directive#properties');
} }
void _populateHost(Expression hostValue) { void _populateHost(Expression hostValue) {
@ -342,7 +342,7 @@ class _DirectiveMetadataVisitor extends Object
void _populateEvents(Expression eventsValue) { void _populateEvents(Expression eventsValue) {
_checkMeta(); _checkMeta();
_populateList(eventsValue, _events, 'Directive#events'); _populateList(eventsValue, _outputs, 'Directive#events');
} }
void _populateChangeDetection(Expression value) { void _populateChangeDetection(Expression value) {

View File

@ -32,8 +32,8 @@ class Processor implements CodegenModel {
void _processViewDefinition(ViewDefinitionEntry viewDefEntry) { void _processViewDefinition(ViewDefinitionEntry viewDefEntry) {
// These are necessary even with generated change detectors. // These are necessary even with generated change detectors.
if (viewDefEntry.hostMetadata != null && if (viewDefEntry.hostMetadata != null &&
viewDefEntry.hostMetadata.events != null) { viewDefEntry.hostMetadata.outputs != null) {
viewDefEntry.hostMetadata.events.forEach((eventName) { viewDefEntry.hostMetadata.outputs.forEach((eventName) {
getterNames.add( getterNames.add(
new ReflectiveAccessor(eventName, isStaticallyNecessary: true)); new ReflectiveAccessor(eventName, isStaticallyNecessary: true));
}); });

View File

@ -12,6 +12,6 @@ void initReflector(reflector) {
ToolTip, ToolTip,
new ReflectionInfo(const [ new ReflectionInfo(const [
const Directive( const Directive(
selector: '[tool-tip]', properties: const ['text: tool-tip']) selector: '[tool-tip]', inputs: const ['text: tool-tip'])
], const [], () => new ToolTip())); ], const [], () => new ToolTip()));
} }

View File

@ -12,7 +12,7 @@ void initReflector(reflector) {
ToolTip, ToolTip,
new ReflectionInfo(const [ new ReflectionInfo(const [
const Directive( const Directive(
selector: '[tool-tip]', properties: const ['text: tool-tip']) selector: '[tool-tip]', inputs: const ['text: tool-tip'])
], const [], () => new ToolTip())) ], const [], () => new ToolTip()))
..registerSetters({'text': (o, v) => o.text = v}); ..registerSetters({'text': (o, v) => o.text = v});
} }

View File

@ -13,12 +13,12 @@ void initReflector(reflector) {
new ReflectionInfo(const [ new ReflectionInfo(const [
const Component( const Component(
componentServices: const [SaladComponent], componentServices: const [SaladComponent],
properties: const ['menu']) inputs: const ['menu'])
], const [], () => new SoupComponent())) ], const [], () => new SoupComponent()))
..registerType( ..registerType(
SaladComponent, SaladComponent,
new ReflectionInfo(const [ new ReflectionInfo(const [
const Component(properties: const ['menu']) const Component(inputs: const ['menu'])
], const [], () => new SaladComponent())) ], const [], () => new SaladComponent()))
..registerSetters({'menu': (o, v) => o.menu = v}); ..registerSetters({'menu': (o, v) => o.menu = v});
} }

View File

@ -13,11 +13,11 @@ void initReflector(reflector) {
new ReflectionInfo(const [ new ReflectionInfo(const [
const Component( const Component(
componentServices: const [SaladComponent], componentServices: const [SaladComponent],
properties: const ['menu']) inputs: const ['menu'])
], const [], () => new SoupComponent())) ], const [], () => new SoupComponent()))
..registerType( ..registerType(
SaladComponent, SaladComponent,
new ReflectionInfo(const [ new ReflectionInfo(const [
const Component(properties: const ['menu']) const Component(inputs: const ['menu'])
], const [], () => new SaladComponent())); ], const [], () => new SaladComponent()));
} }

View File

@ -13,6 +13,6 @@ void initReflector(reflector) {
new ReflectionInfo(const [ new ReflectionInfo(const [
const Directive( const Directive(
selector: '[tool-tip]', selector: '[tool-tip]',
events: const ['onOpen', 'close: onClose']) outputs: const ['onOpen', 'close: onClose'])
], const [], () => new ToolTip())); ], const [], () => new ToolTip()));
} }

View File

@ -13,7 +13,7 @@ void initReflector(reflector) {
new ReflectionInfo(const [ new ReflectionInfo(const [
const Directive( const Directive(
selector: '[tool-tip]', selector: '[tool-tip]',
events: const ['onOpen', 'close: onClose']) outputs: const ['onOpen', 'close: onClose'])
], const [], () => new ToolTip())) ], const [], () => new ToolTip()))
..registerGetters({'onOpen': (o) => o.onOpen, 'close': (o) => o.close}); ..registerGetters({'onOpen': (o) => o.onOpen, 'close': (o) => o.close});
} }

View File

@ -23,7 +23,7 @@ main() {
["AtKey", "AtVal"] ["AtKey", "AtVal"]
]), ]),
id: "someComponent", id: "someComponent",
properties: ["propKey: propVal"], inputs: ["propKey: propVal"],
readAttributes: ["read1", "read2"], readAttributes: ["read1", "read2"],
selector: "some-comp", selector: "some-comp",
type: RenderDirectiveMetadata.COMPONENT_TYPE, type: RenderDirectiveMetadata.COMPONENT_TYPE,
@ -36,7 +36,7 @@ main() {
callAfterContentChecked: true, callAfterContentChecked: true,
callAfterViewInit: true, callAfterViewInit: true,
callAfterViewChecked: true, callAfterViewChecked: true,
events: ["onFoo", "onBar"], outputs: ["onFoo", "onBar"],
changeDetection: ChangeDetectionStrategy.CheckOnce); changeDetection: ChangeDetectionStrategy.CheckOnce);
var map = directiveMetadataToMap(someComponent); var map = directiveMetadataToMap(someComponent);
expect(map["compileChildren"]).toEqual(false); expect(map["compileChildren"]).toEqual(false);
@ -50,7 +50,7 @@ main() {
["AtKey", "AtVal"] ["AtKey", "AtVal"]
])); ]));
expect(map["id"]).toEqual("someComponent"); expect(map["id"]).toEqual("someComponent");
expect(map["properties"]).toEqual(["propKey: propVal"]); expect(map["inputs"]).toEqual(["propKey: propVal"]);
expect(map["readAttributes"]).toEqual(["read1", "read2"]); expect(map["readAttributes"]).toEqual(["read1", "read2"]);
expect(map["selector"]).toEqual("some-comp"); expect(map["selector"]).toEqual("some-comp");
expect(map["type"]).toEqual(RenderDirectiveMetadata.COMPONENT_TYPE); expect(map["type"]).toEqual(RenderDirectiveMetadata.COMPONENT_TYPE);
@ -63,7 +63,7 @@ main() {
expect(map["callAfterViewInit"]).toEqual(true); expect(map["callAfterViewInit"]).toEqual(true);
expect(map["callAfterViewChecked"]).toEqual(true); expect(map["callAfterViewChecked"]).toEqual(true);
expect(map["exportAs"]).toEqual("aaa"); expect(map["exportAs"]).toEqual("aaa");
expect(map["events"]).toEqual(["onFoo", "onBar"]); expect(map["outputs"]).toEqual(["onFoo", "onBar"]);
expect(map["changeDetection"]) expect(map["changeDetection"])
.toEqual(ChangeDetectionStrategy.CheckOnce.index); .toEqual(ChangeDetectionStrategy.CheckOnce.index);
}); });
@ -90,7 +90,7 @@ main() {
], ],
["id", "testId"], ["id", "testId"],
[ [
"properties", "inputs",
["propKey: propVal"] ["propKey: propVal"]
], ],
[ [
@ -109,7 +109,7 @@ main() {
["callAfterViewInit", true], ["callAfterViewInit", true],
["callAfterViewChecked", true], ["callAfterViewChecked", true],
[ [
"events", "outputs",
["onFoo", "onBar"] ["onFoo", "onBar"]
], ],
["changeDetection", ChangeDetectionStrategy.CheckOnce.index] ["changeDetection", ChangeDetectionStrategy.CheckOnce.index]
@ -126,7 +126,7 @@ main() {
["AtKey", "testVal"] ["AtKey", "testVal"]
])); ]));
expect(meta.id).toEqual("testId"); expect(meta.id).toEqual("testId");
expect(meta.properties).toEqual(["propKey: propVal"]); expect(meta.inputs).toEqual(["propKey: propVal"]);
expect(meta.readAttributes).toEqual(["readTest1", "readTest2"]); expect(meta.readAttributes).toEqual(["readTest1", "readTest2"]);
expect(meta.selector).toEqual("testSelector"); expect(meta.selector).toEqual("testSelector");
expect(meta.type).toEqual(RenderDirectiveMetadata.DIRECTIVE_TYPE); expect(meta.type).toEqual(RenderDirectiveMetadata.DIRECTIVE_TYPE);
@ -139,7 +139,7 @@ main() {
expect(meta.callAfterContentChecked).toEqual(true); expect(meta.callAfterContentChecked).toEqual(true);
expect(meta.callAfterViewInit).toEqual(true); expect(meta.callAfterViewInit).toEqual(true);
expect(meta.callAfterViewChecked).toEqual(true); expect(meta.callAfterViewChecked).toEqual(true);
expect(meta.events).toEqual(["onFoo", "onBar"]); expect(meta.outputs).toEqual(["onFoo", "onBar"]);
expect(meta.changeDetection).toEqual(ChangeDetectionStrategy.CheckOnce); expect(meta.changeDetection).toEqual(ChangeDetectionStrategy.CheckOnce);
}); });
}); });

View File

@ -65,13 +65,13 @@ void allTests() {
expect(trueComp.compileChildren).toBeTrue(); expect(trueComp.compileChildren).toBeTrue();
}); });
it('should parse properties.', () async { it('should parse inputs.', () async {
var metadata = await readMetadata('directive_metadata_extractor/' var metadata = await readMetadata('directive_metadata_extractor/'
'directive_metadata_files/properties.ng_deps.dart'); 'directive_metadata_files/properties.ng_deps.dart');
expect(metadata.properties).toBeNotNull(); expect(metadata.inputs).toBeNotNull();
expect(metadata.properties.length).toBe(2); expect(metadata.inputs.length).toBe(2);
expect(metadata.properties).toContain('key1: val1'); expect(metadata.inputs).toContain('key1: val1');
expect(metadata.properties).toContain('key2: val2'); expect(metadata.inputs).toContain('key2: val2');
}); });
it('should parse exportAs.', () async { it('should parse exportAs.', () async {
@ -112,10 +112,10 @@ void allTests() {
expect(metadata.callAfterViewChecked).toBe(true); expect(metadata.callAfterViewChecked).toBe(true);
}); });
it('should parse events.', () async { it('should parse outputs.', () async {
var metadata = await readMetadata('directive_metadata_extractor/' var metadata = await readMetadata('directive_metadata_extractor/'
'directive_metadata_files/events.ng_deps.dart'); 'directive_metadata_files/events.ng_deps.dart');
expect(metadata.events).toEqual(['onFoo', 'onBar']); expect(metadata.outputs).toEqual(['onFoo', 'onBar']);
}); });
it('should parse changeDetection.', () async { it('should parse changeDetection.', () async {

View File

@ -12,7 +12,7 @@ void initReflector(reflector) {
..registerType( ..registerType(
HelloCmp, HelloCmp,
new ReflectionInfo(const [ new ReflectionInfo(const [
const Component(events: const ['onFoo', 'onBar']) const Component(outputs: const ['onFoo', 'onBar'])
], const [ ], const [
const [] const []
], () => new HelloCmp())); ], () => new HelloCmp()));

View File

@ -12,7 +12,7 @@ void initReflector(reflector) {
..registerType( ..registerType(
HelloCmp, HelloCmp,
new ReflectionInfo(const [ new ReflectionInfo(const [
const Component(properties: const ['key1: val1', 'key2: val2']) const Component(inputs: const ['key1: val1', 'key2: val2'])
], const [ ], const [
const [] const []
], () => new HelloCmp())); ], () => new HelloCmp()));

View File

@ -8,7 +8,7 @@
"hostProperties": {}, "hostProperties": {},
"hostListeners": {}, "hostListeners": {},
"hostAttributes": {}, "hostAttributes": {},
"properties": [], "inputs": [],
"readAttributes": [], "readAttributes": [],
"type": 1, "type": 1,
"exportAs": null, "exportAs": null,
@ -20,7 +20,7 @@
"callAfterContentChecked": false, "callAfterContentChecked": false,
"callAfterViewInit": false, "callAfterViewInit": false,
"callAfterViewChecked": false, "callAfterViewChecked": false,
"events": [], "outputs": [],
"changeDetection": null, "changeDetection": null,
"version": 1 "version": 1
} }

View File

@ -8,7 +8,7 @@
"hostProperties": {}, "hostProperties": {},
"hostListeners": {}, "hostListeners": {},
"hostAttributes": {}, "hostAttributes": {},
"properties": null, "inputs": null,
"readAttributes": null, "readAttributes": null,
"type": null, "type": null,
"exportAs": null, "exportAs": null,
@ -20,7 +20,7 @@
"callAfterContentChecked": null, "callAfterContentChecked": null,
"callAfterViewInit": null, "callAfterViewInit": null,
"callAfterViewChecked": null, "callAfterViewChecked": null,
"events": ["dependencyEventName"], "outputs": ["dependencyEventName"],
"changeDetection": null, "changeDetection": null,
"version": 1 "version": 1
} }
@ -34,7 +34,7 @@
"hostProperties": {"hprop": "hprop"}, "hostProperties": {"hprop": "hprop"},
"hostListeners": {}, "hostListeners": {},
"hostAttributes": {}, "hostAttributes": {},
"properties": ["prop"], "inputs": ["prop"],
"readAttributes": null, "readAttributes": null,
"type": null, "type": null,
"exportAs": null, "exportAs": null,
@ -46,7 +46,7 @@
"callAfterContentChecked": null, "callAfterContentChecked": null,
"callAfterViewInit": null, "callAfterViewInit": null,
"callAfterViewChecked": null, "callAfterViewChecked": null,
"events": null, "outpus": null,
"changeDetection": null, "changeDetection": null,
"version": 1 "version": 1
} }
@ -60,7 +60,7 @@
"hostProperties": {}, "hostProperties": {},
"hostListeners": {"subevent": "doAThing()"}, "hostListeners": {"subevent": "doAThing()"},
"hostAttributes": {}, "hostAttributes": {},
"properties": [], "inputs": [],
"readAttributes": null, "readAttributes": null,
"type": null, "type": null,
"exportAs": null, "exportAs": null,
@ -72,7 +72,7 @@
"callAfterContentChecked": null, "callAfterContentChecked": null,
"callAfterViewInit": null, "callAfterViewInit": null,
"callAfterViewChecked": null, "callAfterViewChecked": null,
"events": null, "outputs": null,
"changeDetection": null, "changeDetection": null,
"version": 1 "version": 1
} }
@ -86,7 +86,7 @@
"hostProperties": {}, "hostProperties": {},
"hostListeners": {}, "hostListeners": {},
"hostAttributes": {}, "hostAttributes": {},
"properties": ["ngForOf"], "inputs": ["ngForOf"],
"readAttributes": null, "readAttributes": null,
"type": null, "type": null,
"exportAs": null, "exportAs": null,
@ -98,7 +98,7 @@
"callAfterContentChecked": null, "callAfterContentChecked": null,
"callAfterViewInit": null, "callAfterViewInit": null,
"callAfterViewChecked": null, "callAfterViewChecked": null,
"events": null, "outputs": null,
"changeDetection": null, "changeDetection": null,
"version": 1 "version": 1
} }

View File

@ -30,7 +30,7 @@ void initReflector(reflector) {
..registerType( ..registerType(
EventsCmp, EventsCmp,
new ReflectionInfo(const [ new ReflectionInfo(const [
const Component(selector: 'events', events: const ['eventName']), const Component(selector: 'events', outputs: const ['eventName']),
const View(template: 'Hi') const View(template: 'Hi')
], const [ ], const [
const [] const []

View File

@ -30,7 +30,7 @@ void initReflector(reflector) {
..registerType( ..registerType(
EventsCmp, EventsCmp,
new ReflectionInfo(const [ new ReflectionInfo(const [
const Component(selector: 'events', events: const ['eventName']), const Component(selector: 'events', outputs: const ['eventName']),
const View(template: 'Hi') const View(template: 'Hi')
], const [ ], const [
const [] const []

View File

@ -8,7 +8,7 @@
"hostProperties": {}, "hostProperties": {},
"hostListeners": {}, "hostListeners": {},
"hostAttributes": {}, "hostAttributes": {},
"properties": null, "inputs": null,
"readAttributes": null, "readAttributes": null,
"type": null, "type": null,
"exportAs": null, "exportAs": null,
@ -20,7 +20,7 @@
"callAfterContentChecked": null, "callAfterContentChecked": null,
"callAfterViewInit": null, "callAfterViewInit": null,
"callAfterViewChecked": null, "callAfterViewChecked": null,
"events": null, "outputs": null,
"changeDetection": null, "changeDetection": null,
"version": 1 "version": 1
} }
@ -34,7 +34,7 @@
"hostProperties": {}, "hostProperties": {},
"hostListeners": {}, "hostListeners": {},
"hostAttributes": {}, "hostAttributes": {},
"properties": [], "inputs": [],
"readAttributes": [], "readAttributes": [],
"type": 0, "type": 0,
"exportAs": null, "exportAs": null,
@ -46,7 +46,7 @@
"callAfterContentChecked": false, "callAfterContentChecked": false,
"callAfterViewInit": false, "callAfterViewInit": false,
"callAfterViewChecked": false, "callAfterViewChecked": false,
"events": [], "outputs": [],
"changeDetection": null, "changeDetection": null,
"version": 1 "version": 1
} }
@ -55,12 +55,12 @@
"kind": "type", "kind": "type",
"value": { "value": {
"id": "EventsCmp", "id": "EventsCmp",
"selector": "events", "selector": "outputs",
"compileChildren": true, "compileChildren": true,
"hostProperties": {}, "hostProperties": {},
"hostListeners": {}, "hostListeners": {},
"hostAttributes": {}, "hostAttributes": {},
"properties": [], "inputs": [],
"readAttributes": [], "readAttributes": [],
"type": 1, "type": 1,
"exportAs": null, "exportAs": null,
@ -72,7 +72,7 @@
"callAfterContentChecked": false, "callAfterContentChecked": false,
"callAfterViewInit": false, "callAfterViewInit": false,
"callAfterViewChecked": false, "callAfterViewChecked": false,
"events": ["eventName"], "outputs": ["eventName"],
"changeDetection": null, "changeDetection": null,
"version": 1 "version": 1
} }
@ -81,12 +81,12 @@
"kind": "type", "kind": "type",
"value": { "value": {
"id": "SubEventsCmp", "id": "SubEventsCmp",
"selector": "events", "selector": "outputs",
"compileChildren": true, "compileChildren": true,
"hostProperties": {}, "hostProperties": {},
"hostListeners": {}, "hostListeners": {},
"hostAttributes": {}, "hostAttributes": {},
"properties": [], "inputs": [],
"readAttributes": [], "readAttributes": [],
"type": 1, "type": 1,
"exportAs": null, "exportAs": null,
@ -98,7 +98,7 @@
"callAfterContentChecked": false, "callAfterContentChecked": false,
"callAfterViewInit": false, "callAfterViewInit": false,
"callAfterViewChecked": false, "callAfterViewChecked": false,
"events": [], "outputs": [],
"changeDetection": null, "changeDetection": null,
"version": 1 "version": 1
} }
@ -112,7 +112,7 @@
"hostProperties": {}, "hostProperties": {},
"hostListeners": {}, "hostListeners": {},
"hostAttributes": {}, "hostAttributes": {},
"properties": [], "inputs": [],
"readAttributes": [], "readAttributes": [],
"type": 1, "type": 1,
"exportAs": null, "exportAs": null,
@ -124,7 +124,7 @@
"callAfterContentChecked": false, "callAfterContentChecked": false,
"callAfterViewInit": false, "callAfterViewInit": false,
"callAfterViewChecked": false, "callAfterViewChecked": false,
"events": [], "outputs": [],
"changeDetection": null, "changeDetection": null,
"version": 1 "version": 1
} }
@ -138,7 +138,7 @@
"hostProperties": {}, "hostProperties": {},
"hostListeners": {}, "hostListeners": {},
"hostAttributes": {}, "hostAttributes": {},
"properties": [], "inputs": [],
"readAttributes": [], "readAttributes": [],
"type": 1, "type": 1,
"exportAs": null, "exportAs": null,
@ -150,7 +150,7 @@
"callAfterContentChecked": false, "callAfterContentChecked": false,
"callAfterViewInit": false, "callAfterViewInit": false,
"callAfterViewChecked": false, "callAfterViewChecked": false,
"events": [], "outputs": [],
"changeDetection": null, "changeDetection": null,
"version": 1 "version": 1
} }
@ -164,7 +164,7 @@
"hostProperties": {}, "hostProperties": {},
"hostListeners": {}, "hostListeners": {},
"hostAttributes": {}, "hostAttributes": {},
"properties": [], "inputs": [],
"readAttributes": [], "readAttributes": [],
"type": 1, "type": 1,
"exportAs": null, "exportAs": null,
@ -176,7 +176,7 @@
"callAfterContentChecked": false, "callAfterContentChecked": false,
"callAfterViewInit": false, "callAfterViewInit": false,
"callAfterViewChecked": false, "callAfterViewChecked": false,
"events": [], "outputs": [],
"changeDetection": null, "changeDetection": null,
"version": 1 "version": 1
} }
@ -190,7 +190,7 @@
"hostProperties": {}, "hostProperties": {},
"hostListeners": {}, "hostListeners": {},
"hostAttributes": {}, "hostAttributes": {},
"properties": [], "inputs": [],
"readAttributes": [], "readAttributes": [],
"type": 1, "type": 1,
"exportAs": null, "exportAs": null,
@ -202,7 +202,7 @@
"callAfterContentChecked": false, "callAfterContentChecked": false,
"callAfterViewInit": false, "callAfterViewInit": false,
"callAfterViewChecked": false, "callAfterViewChecked": false,
"events": [], "outputs": [],
"changeDetection": null, "changeDetection": null,
"version": 1 "version": 1
} }