From adbfd29fd761135d51985564edcb4db7f8b6a26a Mon Sep 17 00:00:00 2001 From: vsavkin Date: Wed, 30 Sep 2015 20:59:23 -0700 Subject: [PATCH] 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;} --- .../src/compiler/change_definition_factory.ts | 6 +- .../angular2/src/compiler/command_compiler.ts | 2 +- .../src/compiler/directive_metadata.ts | 56 +++++++-------- .../angular2/src/compiler/runtime_metadata.ts | 4 +- modules/angular2/src/compiler/template_ast.ts | 6 +- .../src/compiler/template_compiler.ts | 4 +- .../angular2/src/compiler/template_parser.ts | 4 +- .../change_detection/change_detector_ref.ts | 2 +- .../src/core/change_detection/exceptions.ts | 4 +- .../src/core/compiler/directive_resolver.ts | 37 +++++----- .../src/core/compiler/element_injector.ts | 7 +- .../angular2/src/core/compiler/interfaces.ts | 2 +- .../angular2/src/core/directives/ng_class.ts | 2 +- .../angular2/src/core/directives/ng_for.ts | 2 +- modules/angular2/src/core/directives/ng_if.ts | 2 +- .../angular2/src/core/directives/ng_style.ts | 2 +- .../angular2/src/core/directives/ng_switch.ts | 4 +- modules/angular2/src/core/facade/async.ts | 6 +- .../core/forms/directives/ng_control_group.ts | 2 +- .../core/forms/directives/ng_control_name.ts | 4 +- .../src/core/forms/directives/ng_form.ts | 2 +- .../core/forms/directives/ng_form_control.ts | 4 +- .../core/forms/directives/ng_form_model.ts | 4 +- .../src/core/forms/directives/ng_model.ts | 4 +- modules/angular2/src/core/metadata.dart | 28 ++++---- modules/angular2/src/core/metadata.ts | 48 ++++++------- modules/angular2/src/core/metadata/di.ts | 2 +- .../angular2/src/core/metadata/directives.ts | 70 +++++++++---------- modules/angular2/src/core/render/api.ts | 30 ++++---- .../render/dom/compiler/directive_parser.ts | 4 +- .../src/mock/directive_resolver_mock.ts | 8 +-- modules/angular2/src/router/router_link.ts | 2 +- .../src/web_workers/shared/serializer.ts | 8 +-- .../change_definition_factory_spec.ts | 4 +- .../test/compiler/directive_metadata_spec.ts | 4 +- .../test/compiler/runtime_metadata_spec.ts | 8 +-- .../test/compiler/template_compiler_spec.ts | 4 +- .../test/compiler/template_parser_spec.ts | 42 ++++------- .../test/core/compiler/compiler_spec.ts | 4 +- .../core/compiler/directive_resolver_spec.ts | 48 ++++++------- .../core/compiler/element_injector_spec.ts | 4 +- .../core/compiler/integration_dart_spec.dart | 4 +- .../test/core/compiler/integration_spec.ts | 30 ++++---- .../compiler/projection_integration_spec.ts | 4 +- .../core/compiler/query_integration_spec.ts | 2 +- .../test/core/debug/debug_element_spec.ts | 4 +- .../directive_lifecycle_integration_spec.ts | 2 +- .../dom/compiler/directive_parser_spec.ts | 7 +- modules/angular2/test/public_api_spec.ts | 40 +++++------ .../src/components/button/button.ts | 2 +- .../src/components/checkbox/checkbox.ts | 2 +- .../src/components/grid_list/grid_list.ts | 4 +- .../src/components/input/input.ts | 2 +- .../progress-linear/progress_linear.ts | 2 +- .../src/components/radio/radio_button.ts | 6 +- .../src/components/switcher/switch.ts | 2 +- .../src/compiler/compiler_benchmark.ts | 10 +-- .../src/largetable/largetable_benchmark.ts | 2 +- .../src/naive_infinite_scroll/cells.ts | 12 ++-- .../src/naive_infinite_scroll/scroll_item.ts | 2 +- .../src/static_tree/tree_benchmark.ts | 20 +++--- modules/benchmarks/src/tree/tree_benchmark.ts | 2 +- modules/examples/src/material/dialog/index.ts | 2 +- .../examples/src/model_driven_forms/index.ts | 2 +- .../examples/src/observable_models/cells.dart | 12 ++-- .../src/observable_models/scroll_item.dart | 2 +- .../examples/src/order_management/index.ts | 2 +- .../src/template_driven_forms/index.ts | 2 +- modules/examples/src/zippy_component/zippy.ts | 7 +- .../test/tasks_test.server.spec.dart | 2 +- .../transform/bind_generator/generator.dart | 4 +- .../lib/src/transform/common/convert.dart | 8 +-- .../common/directive_metadata_reader.dart | 20 +++--- .../reflection/processor.dart | 4 +- .../basic_bind_files/bar.ng_deps.dart | 2 +- .../expected/bar.ng_deps.dart | 2 +- .../expected/soup.ng_deps.dart | 4 +- .../soup.ng_deps.dart | 4 +- .../events_files/bar.ng_deps.dart | 2 +- .../events_files/expected/bar.ng_deps.dart | 2 +- .../test/transform/common/convert_spec.dart | 16 ++--- .../all_tests.dart | 14 ++-- .../events.ng_deps.dart | 2 +- .../properties.ng_deps.dart | 2 +- .../expected/bar.ng_meta.json | 4 +- .../dependency.ng_meta.json | 16 ++--- .../expected/registrations.ng_deps.dart | 2 +- .../registrations.ng_deps.dart | 2 +- .../registrations.ng_meta.json | 36 +++++----- 89 files changed, 405 insertions(+), 423 deletions(-) diff --git a/modules/angular2/src/compiler/change_definition_factory.ts b/modules/angular2/src/compiler/change_definition_factory.ts index aff8ea49db..259b2e52b3 100644 --- a/modules/angular2/src/compiler/change_definition_factory.ts +++ b/modules/angular2/src/compiler/change_definition_factory.ts @@ -77,8 +77,8 @@ class ProtoViewVisitor implements TemplateAstVisitor { if (ast.isBound()) { this.boundElementCount++; } - templateVisitAll(this, ast.properties, null); - templateVisitAll(this, ast.events); + templateVisitAll(this, ast.inputs, null); + templateVisitAll(this, ast.outputs); templateVisitAll(this, ast.exportAsVars); for (var i = 0; i < ast.directives.length; i++) { ast.directives[i].visit(this, i); @@ -158,7 +158,7 @@ class ProtoViewVisitor implements TemplateAstVisitor { }); this.directiveRecords.push(directiveRecord); - templateVisitAll(this, ast.properties, directiveRecord); + templateVisitAll(this, ast.inputs, directiveRecord); var bindingRecords = this.bindingRecords; if (directiveRecord.callOnChanges) { bindingRecords.push(BindingRecord.createDirectiveOnChanges(directiveRecord)); diff --git a/modules/angular2/src/compiler/command_compiler.ts b/modules/angular2/src/compiler/command_compiler.ts index f5256d066b..7bd6b3f4c3 100644 --- a/modules/angular2/src/compiler/command_compiler.ts +++ b/modules/angular2/src/compiler/command_compiler.ts @@ -246,7 +246,7 @@ class CommandBuilderVisitor implements TemplateAstVisitor { } visitElement(ast: ElementAst, context: any): any { var component = ast.getComponent(); - var eventTargetAndNames = visitAndReturnContext(this, ast.events, []); + var eventTargetAndNames = visitAndReturnContext(this, ast.outputs, []); var variableNameAndValues = []; if (isBlank(component)) { ast.exportAsVars.forEach((varAst) => { diff --git a/modules/angular2/src/compiler/directive_metadata.ts b/modules/angular2/src/compiler/directive_metadata.ts index 2ac9f88024..73ca87cefb 100644 --- a/modules/angular2/src/compiler/directive_metadata.ts +++ b/modules/angular2/src/compiler/directive_metadata.ts @@ -94,16 +94,16 @@ export class CompileTemplateMetadata { } export class CompileDirectiveMetadata { - static create({type, isComponent, dynamicLoadable, selector, exportAs, changeDetection, - properties, events, host, lifecycleHooks, template}: { + static create({type, isComponent, dynamicLoadable, selector, exportAs, changeDetection, inputs, + outputs, host, lifecycleHooks, template}: { type?: CompileTypeMetadata, isComponent?: boolean, dynamicLoadable?: boolean, selector?: string, exportAs?: string, changeDetection?: ChangeDetectionStrategy, - properties?: string[], - events?: string[], + inputs?: string[], + outputs?: string[], host?: StringMap, lifecycleHooks?: LifecycleHooks[], template?: CompileTemplateMetadata @@ -123,22 +123,22 @@ export class CompileDirectiveMetadata { } }); } - var propsMap = {}; - if (isPresent(properties)) { - properties.forEach((bindConfig: string) => { + var inputsMap = {}; + if (isPresent(inputs)) { + inputs.forEach((bindConfig: string) => { // canonical syntax: `dirProp: elProp` // if there is no `:`, use dirProp = elProp var parts = splitAtColon(bindConfig, [bindConfig, bindConfig]); - propsMap[parts[0]] = parts[1]; + inputsMap[parts[0]] = parts[1]; }); } - var eventsMap = {}; - if (isPresent(events)) { - events.forEach((bindConfig: string) => { + var outputsMap = {}; + if (isPresent(outputs)) { + outputs.forEach((bindConfig: string) => { // canonical syntax: `dirProp: elProp` // if there is no `:`, use dirProp = elProp 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, exportAs: exportAs, changeDetection: changeDetection, - properties: propsMap, - events: eventsMap, + inputs: inputsMap, + outputs: outputsMap, hostListeners: hostListeners, hostProperties: hostProperties, hostAttributes: hostAttributes, @@ -164,23 +164,23 @@ export class CompileDirectiveMetadata { selector: string; exportAs: string; changeDetection: ChangeDetectionStrategy; - properties: StringMap; - events: StringMap; + inputs: StringMap; + outputs: StringMap; hostListeners: StringMap; hostProperties: StringMap; hostAttributes: StringMap; lifecycleHooks: LifecycleHooks[]; template: CompileTemplateMetadata; - constructor({type, isComponent, dynamicLoadable, selector, exportAs, changeDetection, properties, - events, hostListeners, hostProperties, hostAttributes, lifecycleHooks, template}: { + constructor({type, isComponent, dynamicLoadable, selector, exportAs, changeDetection, inputs, + outputs, hostListeners, hostProperties, hostAttributes, lifecycleHooks, template}: { type?: CompileTypeMetadata, isComponent?: boolean, dynamicLoadable?: boolean, selector?: string, exportAs?: string, changeDetection?: ChangeDetectionStrategy, - properties?: StringMap, - events?: StringMap, + inputs?: StringMap, + outputs?: StringMap, hostListeners?: StringMap, hostProperties?: StringMap, hostAttributes?: StringMap, @@ -193,8 +193,8 @@ export class CompileDirectiveMetadata { this.selector = selector; this.exportAs = exportAs; this.changeDetection = changeDetection; - this.properties = properties; - this.events = events; + this.inputs = inputs; + this.outputs = outputs; this.hostListeners = hostListeners; this.hostProperties = hostProperties; this.hostAttributes = hostAttributes; @@ -212,8 +212,8 @@ export class CompileDirectiveMetadata { changeDetection: isPresent(data['changeDetection']) ? CHANGE_DECTION_STRATEGY_VALUES[data['changeDetection']] : data['changeDetection'], - properties: data['properties'], - events: data['events'], + inputs: data['inputs'], + outputs: data['outputs'], hostListeners: data['hostListeners'], hostProperties: data['hostProperties'], hostAttributes: data['hostAttributes'], @@ -233,8 +233,8 @@ export class CompileDirectiveMetadata { 'type': isPresent(this.type) ? this.type.toJson() : this.type, 'changeDetection': isPresent(this.changeDetection) ? serializeEnum(this.changeDetection) : this.changeDetection, - 'properties': this.properties, - 'events': this.events, + 'inputs': this.inputs, + 'outputs': this.outputs, 'hostListeners': this.hostListeners, 'hostProperties': this.hostProperties, 'hostAttributes': this.hostAttributes, @@ -253,8 +253,8 @@ export function createHostComponentMeta(componentType: CompileTypeMetadata, template: new CompileTemplateMetadata( {template: template, templateUrl: '', styles: [], styleUrls: [], ngContentSelectors: []}), changeDetection: ChangeDetectionStrategy.Default, - properties: [], - events: [], + inputs: [], + outputs: [], host: {}, lifecycleHooks: [], isComponent: true, diff --git a/modules/angular2/src/compiler/runtime_metadata.ts b/modules/angular2/src/compiler/runtime_metadata.ts index 3b0a014c22..cdc6bf219d 100644 --- a/modules/angular2/src/compiler/runtime_metadata.ts +++ b/modules/angular2/src/compiler/runtime_metadata.ts @@ -58,8 +58,8 @@ export class RuntimeMetadataResolver { {name: stringify(directiveType), moduleId: moduleId, runtime: directiveType}), template: templateMeta, changeDetection: changeDetectionStrategy, - properties: directiveAnnotation.properties, - events: directiveAnnotation.events, + inputs: directiveAnnotation.inputs, + outputs: directiveAnnotation.outputs, host: directiveAnnotation.host, lifecycleHooks: ListWrapper.filter(LIFECYCLE_HOOKS_VALUES, hook => hasLifecycleHook(hook, directiveType)) diff --git a/modules/angular2/src/compiler/template_ast.ts b/modules/angular2/src/compiler/template_ast.ts index d752383a41..54f1c31033 100644 --- a/modules/angular2/src/compiler/template_ast.ts +++ b/modules/angular2/src/compiler/template_ast.ts @@ -56,7 +56,7 @@ export class VariableAst implements TemplateAst { export class ElementAst implements TemplateAst { 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 children: TemplateAst[], public ngContentIndex: number, public sourceInfo: string) {} @@ -65,7 +65,7 @@ export class ElementAst implements TemplateAst { } 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); } @@ -95,7 +95,7 @@ export class BoundDirectivePropertyAst implements TemplateAst { export class DirectiveAst implements TemplateAst { constructor(public directive: CompileDirectiveMetadata, - public properties: BoundDirectivePropertyAst[], + public inputs: BoundDirectivePropertyAst[], public hostProperties: BoundElementPropertyAst[], public hostEvents: BoundEventAst[], public exportAsVars: VariableAst[], public sourceInfo: string) {} visit(visitor: TemplateAstVisitor, context: any): any { diff --git a/modules/angular2/src/compiler/template_compiler.ts b/modules/angular2/src/compiler/template_compiler.ts index 0588235bed..6bb03677e0 100644 --- a/modules/angular2/src/compiler/template_compiler.ts +++ b/modules/angular2/src/compiler/template_compiler.ts @@ -65,8 +65,8 @@ export class TemplateCompiler { selector: directive.selector, exportAs: directive.exportAs, changeDetection: directive.changeDetection, - properties: directive.properties, - events: directive.events, + inputs: directive.inputs, + outputs: directive.outputs, hostListeners: directive.hostListeners, hostProperties: directive.hostProperties, hostAttributes: directive.hostAttributes, diff --git a/modules/angular2/src/compiler/template_parser.ts b/modules/angular2/src/compiler/template_parser.ts index b145526351..91af5472f5 100644 --- a/modules/angular2/src/compiler/template_parser.ts +++ b/modules/angular2/src/compiler/template_parser.ts @@ -415,7 +415,7 @@ class TemplateParseVisitor implements HtmlAstVisitor { this._createDirectiveHostPropertyAsts(elementName, directive.hostProperties, sourceInfo, hostProperties); this._createDirectiveHostEventAsts(directive.hostListeners, sourceInfo, hostEvents); - this._createDirectivePropertyAsts(directive.properties, props, directiveProperties); + this._createDirectivePropertyAsts(directive.inputs, props, directiveProperties); var exportAsVars = []; possibleExportAsVars.forEach((varAst) => { if ((varAst.value.length === 0 && directive.isComponent) || @@ -489,7 +489,7 @@ class TemplateParseVisitor implements HtmlAstVisitor { var boundElementProps: BoundElementPropertyAst[] = []; var boundDirectivePropsIndex = new Map(); directives.forEach((directive: DirectiveAst) => { - directive.properties.forEach((prop: BoundDirectivePropertyAst) => { + directive.inputs.forEach((prop: BoundDirectivePropertyAst) => { boundDirectivePropsIndex.set(prop.templateName, prop); }); }); diff --git a/modules/angular2/src/core/change_detection/change_detector_ref.ts b/modules/angular2/src/core/change_detection/change_detector_ref.ts index 066465a25b..6a90530231 100644 --- a/modules/angular2/src/core/change_detection/change_detector_ref.ts +++ b/modules/angular2/src/core/change_detection/change_detector_ref.ts @@ -157,7 +157,7 @@ export class ChangeDetectorRef { * } * } * - * @Component({selector: 'live-data', properties: ['live']}) + * @Component({selector: 'live-data', inputs: ['live']}) * @View({ * template: `Data: {{dataProvider.data}}` * }) diff --git a/modules/angular2/src/core/change_detection/exceptions.ts b/modules/angular2/src/core/change_detection/exceptions.ts index f440045616..6da450ea84 100644 --- a/modules/angular2/src/core/change_detection/exceptions.ts +++ b/modules/angular2/src/core/change_detection/exceptions.ts @@ -21,7 +21,7 @@ import {BaseException, WrappedException} from "angular2/src/core/facade/exceptio * parentProp = "init"; * } * - * @Directive({selector: 'child', properties: ['prop']}) + * @Directive({selector: 'child', inputs: ['prop']}) * class Child { * constructor(public parent: Parent) {} * @@ -49,7 +49,7 @@ export class ExpressionChangedAfterItHasBeenCheckedException extends BaseExcepti * ### Example ([live demo](http://plnkr.co/edit/2Kywoz?p=preview)) * * ```typescript - * @Directive({selector: 'child', properties: ['prop']}) + * @Directive({selector: 'child', inputs: ['prop']}) * class Child { * prop; * } diff --git a/modules/angular2/src/core/compiler/directive_resolver.ts b/modules/angular2/src/core/compiler/directive_resolver.ts index 9d87b8f50e..1b384408ca 100644 --- a/modules/angular2/src/core/compiler/directive_resolver.ts +++ b/modules/angular2/src/core/compiler/directive_resolver.ts @@ -5,8 +5,8 @@ import {ListWrapper, StringMap, StringMapWrapper} from 'angular2/src/core/facade import { DirectiveMetadata, ComponentMetadata, - PropertyMetadata, - EventMetadata, + InputMetadata, + OutputMetadata, HostBindingMetadata, HostListenerMetadata, ContentChildrenMetadata, @@ -45,26 +45,26 @@ export class DirectiveResolver { private _mergeWithPropertyMetadata(dm: DirectiveMetadata, propertyMetadata: StringMap): DirectiveMetadata { - var properties = []; - var events = []; + var inputs = []; + var outputs = []; var host = {}; var queries = {}; StringMapWrapper.forEach(propertyMetadata, (metadata: any[], propName: string) => { metadata.forEach(a => { - if (a instanceof PropertyMetadata) { + if (a instanceof InputMetadata) { if (isPresent(a.bindingPropertyName)) { - properties.push(`${propName}: ${a.bindingPropertyName}`); + inputs.push(`${propName}: ${a.bindingPropertyName}`); } else { - properties.push(propName); + inputs.push(propName); } } - if (a instanceof EventMetadata) { + if (a instanceof OutputMetadata) { if (isPresent(a.bindingPropertyName)) { - events.push(`${propName}: ${a.bindingPropertyName}`); + outputs.push(`${propName}: ${a.bindingPropertyName}`); } 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, queries: StringMap): DirectiveMetadata { - var mergedProperties = - isPresent(dm.properties) ? ListWrapper.concat(dm.properties, properties) : properties; - var mergedEvents = isPresent(dm.events) ? ListWrapper.concat(dm.events, events) : events; + var mergedInputs = isPresent(dm.inputs) ? ListWrapper.concat(dm.inputs, inputs) : inputs; + var mergedOutputs = isPresent(dm.outputs) ? ListWrapper.concat(dm.outputs, outputs) : outputs; var mergedHost = isPresent(dm.host) ? StringMapWrapper.merge(dm.host, host) : host; var mergedQueries = isPresent(dm.queries) ? StringMapWrapper.merge(dm.queries, queries) : queries; @@ -114,8 +113,8 @@ export class DirectiveResolver { if (dm instanceof ComponentMetadata) { return new ComponentMetadata({ selector: dm.selector, - properties: mergedProperties, - events: mergedEvents, + inputs: mergedInputs, + outputs: mergedOutputs, host: mergedHost, bindings: dm.bindings, exportAs: dm.exportAs, @@ -129,8 +128,8 @@ export class DirectiveResolver { } else { return new DirectiveMetadata({ selector: dm.selector, - properties: mergedProperties, - events: mergedEvents, + inputs: mergedInputs, + outputs: mergedOutputs, host: mergedHost, bindings: dm.bindings, exportAs: dm.exportAs, diff --git a/modules/angular2/src/core/compiler/element_injector.ts b/modules/angular2/src/core/compiler/element_injector.ts index 7c72951e6f..fbed7f7cbe 100644 --- a/modules/angular2/src/core/compiler/element_injector.ts +++ b/modules/angular2/src/core/compiler/element_injector.ts @@ -151,7 +151,8 @@ export class DirectiveBinding extends ResolvedBinding { } 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 { @@ -170,9 +171,9 @@ export class DirectiveBinding extends ResolvedBinding { RenderDirectiveMetadata.DIRECTIVE_TYPE, selector: meta.selector, compileChildren: meta.compileChildren, - events: meta.events, + outputs: meta.outputs, host: isPresent(meta.host) ? MapWrapper.createFromStringMap(meta.host) : null, - properties: meta.properties, + inputs: meta.inputs, readAttributes: DirectiveBinding._readAttributes(deps), queries: meta.queries, diff --git a/modules/angular2/src/core/compiler/interfaces.ts b/modules/angular2/src/core/compiler/interfaces.ts index 7c26874790..53362df056 100644 --- a/modules/angular2/src/core/compiler/interfaces.ts +++ b/modules/angular2/src/core/compiler/interfaces.ts @@ -50,7 +50,7 @@ export var LIFECYCLE_HOOKS_VALUES = [ * propB; * * 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 propA was updated * } diff --git a/modules/angular2/src/core/directives/ng_class.ts b/modules/angular2/src/core/directives/ng_class.ts index 4baa9a027f..db7bf24646 100644 --- a/modules/angular2/src/core/directives/ng_class.ts +++ b/modules/angular2/src/core/directives/ng_class.ts @@ -35,7 +35,7 @@ import { * * ``` */ -@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 { private _differ: any; private _mode: string; diff --git a/modules/angular2/src/core/directives/ng_for.ts b/modules/angular2/src/core/directives/ng_for.ts index 13e786e003..140cd4b7dd 100644 --- a/modules/angular2/src/core/directives/ng_for.ts +++ b/modules/angular2/src/core/directives/ng_for.ts @@ -39,7 +39,7 @@ import {isPresent, isBlank} from 'angular2/src/core/facade/lang'; * - `
  • ...
  • ` * - `` */ -@Directive({selector: '[ng-for][ng-for-of]', properties: ['ngForOf']}) +@Directive({selector: '[ng-for][ng-for-of]', inputs: ['ngForOf']}) export class NgFor implements DoCheck { _ngForOf: any; private _differ: IterableDiffer; diff --git a/modules/angular2/src/core/directives/ng_if.ts b/modules/angular2/src/core/directives/ng_if.ts index 4a65ff7c05..6e749ce52f 100644 --- a/modules/angular2/src/core/directives/ng_if.ts +++ b/modules/angular2/src/core/directives/ng_if.ts @@ -24,7 +24,7 @@ import {isBlank} from 'angular2/src/core/facade/lang'; * - `
    ...
    ` * - `` */ -@Directive({selector: '[ng-if]', properties: ['ngIf']}) +@Directive({selector: '[ng-if]', inputs: ['ngIf']}) export class NgIf { private _prevCondition: boolean = null; diff --git a/modules/angular2/src/core/directives/ng_style.ts b/modules/angular2/src/core/directives/ng_style.ts index aca889132e..69aec04597 100644 --- a/modules/angular2/src/core/directives/ng_style.ts +++ b/modules/angular2/src/core/directives/ng_style.ts @@ -29,7 +29,7 @@ import {isPresent, isBlank, print} from 'angular2/src/core/facade/lang'; * - `
    ` * - `
    ` */ -@Directive({selector: '[ng-style]', properties: ['rawStyle: ng-style']}) +@Directive({selector: '[ng-style]', inputs: ['rawStyle: ng-style']}) export class NgStyle implements DoCheck { _rawStyle; _differ: KeyValueDiffer; diff --git a/modules/angular2/src/core/directives/ng_switch.ts b/modules/angular2/src/core/directives/ng_switch.ts index d23cac232a..9f723a29fc 100644 --- a/modules/angular2/src/core/directives/ng_switch.ts +++ b/modules/angular2/src/core/directives/ng_switch.ts @@ -39,7 +39,7 @@ export class SwitchView { *
    * ``` */ -@Directive({selector: '[ng-switch]', properties: ['ngSwitch']}) +@Directive({selector: '[ng-switch]', inputs: ['ngSwitch']}) export class NgSwitch { private _switchValue: any; private _useDefault: boolean = false; @@ -139,7 +139,7 @@ export class NgSwitch { * * ``` */ -@Directive({selector: '[ng-switch-when]', properties: ['ngSwitchWhen']}) +@Directive({selector: '[ng-switch-when]', inputs: ['ngSwitchWhen']}) export class NgSwitchWhen { // `_WHEN_DEFAULT` is used as a marker for a not yet initialized value _value: any = _WHEN_DEFAULT; diff --git a/modules/angular2/src/core/facade/async.ts b/modules/angular2/src/core/facade/async.ts index 058b8b23ea..a805871c9d 100644 --- a/modules/angular2/src/core/facade/async.ts +++ b/modules/angular2/src/core/facade/async.ts @@ -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 * @@ -109,8 +109,8 @@ export class Observable { * `}) * export class Zippy { * visible: boolean = true; - * @Event() open: EventEmitter = new EventEmitter(); - * @Event() close: EventEmitter = new EventEmitter(); + * @Output() open: EventEmitter = new EventEmitter(); + * @Output() close: EventEmitter = new EventEmitter(); * * toggle() { * this.visible = !this.visible; diff --git a/modules/angular2/src/core/forms/directives/ng_control_group.ts b/modules/angular2/src/core/forms/directives/ng_control_group.ts index bb818ab279..ec963c65de 100644 --- a/modules/angular2/src/core/forms/directives/ng_control_group.ts +++ b/modules/angular2/src/core/forms/directives/ng_control_group.ts @@ -53,7 +53,7 @@ const controlGroupBinding = @Directive({ selector: '[ng-control-group]', bindings: [controlGroupBinding], - properties: ['name: ng-control-group'], + inputs: ['name: ng-control-group'], exportAs: 'form' }) export class NgControlGroup extends ControlContainer implements OnInit, diff --git a/modules/angular2/src/core/forms/directives/ng_control_name.ts b/modules/angular2/src/core/forms/directives/ng_control_name.ts index 15286ad1f8..a006a5d6ed 100644 --- a/modules/angular2/src/core/forms/directives/ng_control_name.ts +++ b/modules/angular2/src/core/forms/directives/ng_control_name.ts @@ -75,8 +75,8 @@ const controlNameBinding = @Directive({ selector: '[ng-control]', bindings: [controlNameBinding], - properties: ['name: ngControl', 'model: ngModel'], - events: ['update: ngModel'], + inputs: ['name: ngControl', 'model: ngModel'], + outputs: ['update: ngModel'], exportAs: 'form' }) export class NgControlName extends NgControl implements OnChanges, diff --git a/modules/angular2/src/core/forms/directives/ng_form.ts b/modules/angular2/src/core/forms/directives/ng_form.ts index 4d5a38743a..77bc3681d3 100644 --- a/modules/angular2/src/core/forms/directives/ng_form.ts +++ b/modules/angular2/src/core/forms/directives/ng_form.ts @@ -85,7 +85,7 @@ const formDirectiveBinding = host: { '(submit)': 'onSubmit()', }, - events: ['ngSubmit'], + outputs: ['ngSubmit'], exportAs: 'form' }) export class NgForm extends ControlContainer implements Form { diff --git a/modules/angular2/src/core/forms/directives/ng_form_control.ts b/modules/angular2/src/core/forms/directives/ng_form_control.ts index 0a311aae75..9c6482bf52 100644 --- a/modules/angular2/src/core/forms/directives/ng_form_control.ts +++ b/modules/angular2/src/core/forms/directives/ng_form_control.ts @@ -65,8 +65,8 @@ const formControlBinding = @Directive({ selector: '[ng-form-control]', bindings: [formControlBinding], - properties: ['form: ngFormControl', 'model: ngModel'], - events: ['update: ngModel'], + inputs: ['form: ngFormControl', 'model: ngModel'], + outputs: ['update: ngModel'], exportAs: 'form' }) export class NgFormControl extends NgControl implements OnChanges { diff --git a/modules/angular2/src/core/forms/directives/ng_form_model.ts b/modules/angular2/src/core/forms/directives/ng_form_model.ts index b00fb5c176..633ebbff5a 100644 --- a/modules/angular2/src/core/forms/directives/ng_form_model.ts +++ b/modules/angular2/src/core/forms/directives/ng_form_model.ts @@ -92,9 +92,9 @@ const formDirectiveBinding = @Directive({ selector: '[ng-form-model]', bindings: [formDirectiveBinding], - properties: ['form: ng-form-model'], + inputs: ['form: ng-form-model'], host: {'(submit)': 'onSubmit()'}, - events: ['ngSubmit'], + outputs: ['ngSubmit'], exportAs: 'form' }) export class NgFormModel extends ControlContainer implements Form, diff --git a/modules/angular2/src/core/forms/directives/ng_model.ts b/modules/angular2/src/core/forms/directives/ng_model.ts index d89df4442b..95ec3e6cf9 100644 --- a/modules/angular2/src/core/forms/directives/ng_model.ts +++ b/modules/angular2/src/core/forms/directives/ng_model.ts @@ -36,8 +36,8 @@ const formControlBinding = CONST_EXPR(new Binding(NgControl, {toAlias: forwardRe @Directive({ selector: '[ng-model]:not([ng-control]):not([ng-form-control])', bindings: [formControlBinding], - properties: ['model: ngModel'], - events: ['update: ngModel'], + inputs: ['model: ngModel'], + outputs: ['update: ngModel'], exportAs: 'form' }) export class NgModel extends NgControl implements OnChanges { diff --git a/modules/angular2/src/core/metadata.dart b/modules/angular2/src/core/metadata.dart index e75caa30bb..5c02cedf0f 100644 --- a/modules/angular2/src/core/metadata.dart +++ b/modules/angular2/src/core/metadata.dart @@ -14,15 +14,15 @@ export './metadata/view.dart'; * See: [DirectiveMetadata] for docs. */ class Directive extends DirectiveMetadata { - const Directive({String selector, List properties, - List events, Map host, + const Directive({String selector, List inputs, + List outputs, Map host, List bindings, String exportAs, String moduleId, Map queries, bool compileChildren: true}) : super( selector: selector, - properties: properties, - events: events, + inputs: inputs, + outputs: outputs, host: host, bindings: bindings, exportAs: exportAs, @@ -35,15 +35,15 @@ class Directive extends DirectiveMetadata { * See: [ComponentMetadata] for docs. */ class Component extends ComponentMetadata { - const Component({String selector, List properties, - List events, Map host, + const Component({String selector, List inputs, + List outputs, Map host, List bindings, String exportAs, String moduleId, Map queries, bool compileChildren, List viewBindings, ChangeDetectionStrategy changeDetection}) : super( selector: selector, - properties: properties, - events: events, + inputs: inputs, + outputs: outputs, host: host, bindings: bindings, exportAs: exportAs, @@ -134,18 +134,18 @@ class ViewChild extends ViewChildMetadata { } /** - * See: [PropertyMetadata] for docs. + * See: [InputMetadata] for docs. */ -class Property extends PropertyMetadata { - const Property([String bindingPropertyName]) +class Input extends InputMetadata { + const Input([String bindingPropertyName]) : super(bindingPropertyName); } /** - * See: [EventMetadata] for docs. + * See: [OutputMetadata] for docs. */ -class Event extends EventMetadata { - const Event([String bindingPropertyName]) +class Output extends OutputMetadata { + const Output([String bindingPropertyName]) : super(bindingPropertyName); } diff --git a/modules/angular2/src/core/metadata.ts b/modules/angular2/src/core/metadata.ts index 243ae43263..40cc6c814b 100644 --- a/modules/angular2/src/core/metadata.ts +++ b/modules/angular2/src/core/metadata.ts @@ -17,8 +17,8 @@ export { ComponentMetadata, DirectiveMetadata, PipeMetadata, - PropertyMetadata, - EventMetadata, + InputMetadata, + OutputMetadata, HostBindingMetadata, HostListenerMetadata } from './metadata/directives'; @@ -39,8 +39,8 @@ import { ComponentMetadata, DirectiveMetadata, PipeMetadata, - PropertyMetadata, - EventMetadata, + InputMetadata, + OutputMetadata, HostBindingMetadata, HostListenerMetadata } from './metadata/directives'; @@ -147,8 +147,8 @@ export interface ViewDecorator extends TypeDecorator { export interface DirectiveFactory { (obj: { selector?: string, - properties?: string[], - events?: string[], + inputs?: string[], + outputs?: string[], host?: StringMap, bindings?: any[], exportAs?: string, @@ -158,8 +158,8 @@ export interface DirectiveFactory { }): DirectiveDecorator; new (obj: { selector?: string, - properties?: string[], - events?: string[], + inputs?: string[], + outputs?: string[], host?: StringMap, bindings?: any[], exportAs?: string, @@ -215,8 +215,8 @@ export interface DirectiveFactory { export interface ComponentFactory { (obj: { selector?: string, - properties?: string[], - events?: string[], + inputs?: string[], + outputs?: string[], host?: StringMap, bindings?: any[], exportAs?: string, @@ -228,8 +228,8 @@ export interface ComponentFactory { }): ComponentDecorator; new (obj: { selector?: string, - properties?: string[], - events?: string[], + inputs?: string[], + outputs?: string[], host?: StringMap, bindings?: any[], 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; 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; new (bindingPropertyName?: string): any; } @@ -567,18 +567,18 @@ export var ViewQuery: QueryFactory = makeParamDecorator(ViewQueryMetadata); export var Pipe: 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. diff --git a/modules/angular2/src/core/metadata/di.ts b/modules/angular2/src/core/metadata/di.ts index 789ff921e1..e5369eba19 100644 --- a/modules/angular2/src/core/metadata/di.ts +++ b/modules/angular2/src/core/metadata/di.ts @@ -71,7 +71,7 @@ export class AttributeMetadata extends DependencyMetadata { * ```javascript * @Component({ * selector: 'pane', - * properties: ['title'] + * inputs: ['title'] * }) * @View(...) * class Pane { diff --git a/modules/angular2/src/core/metadata/directives.ts b/modules/angular2/src/core/metadata/directives.ts index 2ea393339c..2505c35016 100644 --- a/modules/angular2/src/core/metadata/directives.ts +++ b/modules/angular2/src/core/metadata/directives.ts @@ -96,7 +96,7 @@ import {ChangeDetectionStrategy} from 'angular2/src/core/change_detection'; * * @Directive({ * selector: '[dependency]', - * properties: [ + * inputs: [ * 'id: dependency' * ] * }) @@ -242,7 +242,7 @@ import {ChangeDetectionStrategy} from 'angular2/src/core/change_detection'; * ``` * @Directive({ * selector: '[tooltip]', - * properties: [ + * inputs: [ * 'text: tooltip' * ], * host: { @@ -332,7 +332,7 @@ import {ChangeDetectionStrategy} from 'angular2/src/core/change_detection'; * ``` * @Directive({ * selector: '[unless]', - * properties: ['unless'] + * inputs: ['unless'] * }) * export class Unless { * viewContainer: ViewContainerRef; @@ -417,11 +417,11 @@ export class DirectiveMetadata extends InjectableMetadata { 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: * * - `directiveProperty` specifies the component property where the value is written. @@ -436,7 +436,7 @@ export class DirectiveMetadata extends InjectableMetadata { * ```typescript * @Component({ * selector: 'bank-account', - * properties: ['bankName', 'id: account-id'] + * inputs: ['bankName', 'id: account-id'] * }) * @View({ * 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 `events` property defines a set of `directiveProperty` to `bindingProperty` + * The `outputs` property defines a set of `directiveProperty` to `bindingProperty` * configuration: * * - `directiveProperty` specifies the component property that emits events. @@ -484,7 +484,7 @@ export class DirectiveMetadata extends InjectableMetadata { * ```typescript * @Directive({ * selector: 'interval-dir', - * events: ['everySecond', 'five5Secs: everyFiveSeconds'] + * outputs: ['everySecond', 'five5Secs: everyFiveSeconds'] * }) * class IntervalDir { * 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. @@ -739,12 +739,12 @@ export class DirectiveMetadata extends InjectableMetadata { queries: StringMap; constructor({ - selector, properties, events, host, bindings, exportAs, moduleId, queries, + selector, inputs, outputs, host, bindings, exportAs, moduleId, queries, compileChildren = true, }: { selector?: string, - properties?: string[], - events?: string[], + inputs?: string[], + outputs?: string[], host?: StringMap, bindings?: any[], exportAs?: string, @@ -754,8 +754,8 @@ export class DirectiveMetadata extends InjectableMetadata { } = {}) { super(); this.selector = selector; - this.properties = properties; - this.events = events; + this.inputs = inputs; + this.outputs = outputs; this.host = host; this.exportAs = exportAs; this.moduleId = moduleId; @@ -861,12 +861,12 @@ export class ComponentMetadata extends DirectiveMetadata { */ 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}: { selector?: string, - properties?: string[], - events?: string[], + inputs?: string[], + outputs?: string[], host?: StringMap, bindings?: any[], exportAs?: string, @@ -878,8 +878,8 @@ export class ComponentMetadata extends DirectiveMetadata { } = {}) { super({ selector: selector, - properties: properties, - events: events, + inputs: inputs, + outputs: outputs, host: host, exportAs: exportAs, 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. * - * `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, * the class property name is used. * * ### Example * - * The following example creates a component with two data-bound properties. + * The following example creates a component with two input properties. * * ```typescript * @Component({selector: 'bank-account'}) @@ -943,8 +943,8 @@ export class PipeMetadata extends InjectableMetadata { * ` * }) * class BankAccount { - * @Property() bankName: string; - * @Property('account-id') id: string; + * @Input() bankName: string; + * @Input('account-id') id: string; * * // this property is not bound, and won't be automatically updated by Angular * normalizedBankName: string; @@ -963,7 +963,7 @@ export class PipeMetadata extends InjectableMetadata { * ``` */ @CONST() -export class PropertyMetadata { +export class InputMetadata { constructor( /** * 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. * - * `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, * the class property name is used. * @@ -988,8 +988,8 @@ export class PropertyMetadata { * selector: 'interval-dir', * }) * class IntervalDir { - * @Event() everySecond = new EventEmitter(); - * @Event('everyFiveSeconds') five5Secs = new EventEmitter(); + * @Output() everySecond = new EventEmitter(); + * @Output('everyFiveSeconds') five5Secs = new EventEmitter(); * * constructor() { * setInterval(() => this.everySecond.next("event"), 1000); @@ -1013,7 +1013,7 @@ export class PropertyMetadata { * ``` */ @CONST() -export class EventMetadata { +export class OutputMetadata { constructor(public bindingPropertyName?: string) {} } diff --git a/modules/angular2/src/core/render/api.ts b/modules/angular2/src/core/render/api.ts index 40f0904935..a46e5ece27 100644 --- a/modules/angular2/src/core/render/api.ts +++ b/modules/angular2/src/core/render/api.ts @@ -143,8 +143,8 @@ export class RenderDirectiveMetadata { id: any; selector: string; compileChildren: boolean; - events: string[]; - properties: string[]; + outputs: string[]; + inputs: string[]; readAttributes: string[]; type: number; callOnDestroy: boolean; @@ -165,18 +165,18 @@ export class RenderDirectiveMetadata { // group 2: "event" from "(event)" private static _hostRegExp = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g; - constructor({id, selector, compileChildren, events, hostListeners, hostProperties, hostAttributes, - properties, readAttributes, type, callOnDestroy, callOnChanges, callDoCheck, - callOnInit, callAfterContentInit, callAfterContentChecked, callAfterViewInit, - callAfterViewChecked, changeDetection, exportAs, queries}: { + constructor({id, selector, compileChildren, outputs, hostListeners, hostProperties, + hostAttributes, inputs, readAttributes, type, callOnDestroy, callOnChanges, + callDoCheck, callOnInit, callAfterContentInit, callAfterContentChecked, + callAfterViewInit, callAfterViewChecked, changeDetection, exportAs, queries}: { id?: string, selector?: string, compileChildren?: boolean, - events?: string[], + outputs?: string[], hostListeners?: Map, hostProperties?: Map, hostAttributes?: Map, - properties?: string[], + inputs?: string[], readAttributes?: string[], type?: number, callOnDestroy?: boolean, @@ -194,11 +194,11 @@ export class RenderDirectiveMetadata { this.id = id; this.selector = selector; this.compileChildren = isPresent(compileChildren) ? compileChildren : true; - this.events = events; + this.outputs = outputs; this.hostListeners = hostListeners; this.hostAttributes = hostAttributes; this.hostProperties = hostProperties; - this.properties = properties; + this.inputs = inputs; this.readAttributes = readAttributes; this.type = type; this.callOnDestroy = callOnDestroy; @@ -214,16 +214,16 @@ export class RenderDirectiveMetadata { 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, callAfterContentChecked, callAfterViewInit, callAfterViewChecked, changeDetection, exportAs, queries}: { id?: string, selector?: string, compileChildren?: boolean, - events?: string[], + outputs?: string[], host?: Map, - properties?: string[], + inputs?: string[], readAttributes?: string[], type?: number, callOnDestroy?: boolean, @@ -259,11 +259,11 @@ export class RenderDirectiveMetadata { id: id, selector: selector, compileChildren: compileChildren, - events: events, + outputs: outputs, hostListeners: hostListeners, hostProperties: hostProperties, hostAttributes: hostAttributes, - properties: properties, + inputs: inputs, readAttributes: readAttributes, type: type, callOnDestroy: callOnDestroy, diff --git a/modules/angular2/src/core/render/dom/compiler/directive_parser.ts b/modules/angular2/src/core/render/dom/compiler/directive_parser.ts index 91e2444415..4a410f5dcc 100644 --- a/modules/angular2/src/core/render/dom/compiler/directive_parser.ts +++ b/modules/angular2/src/core/render/dom/compiler/directive_parser.ts @@ -65,8 +65,8 @@ export class DirectiveParser implements CompileStep { var dirMetadata = this._directives[directiveIndex]; var directiveBinderBuilder = elementBinder.bindDirective(directiveIndex); current.compileChildren = current.compileChildren && dirMetadata.compileChildren; - if (isPresent(dirMetadata.properties)) { - ListWrapper.forEach(dirMetadata.properties, (bindConfig) => { + if (isPresent(dirMetadata.inputs)) { + ListWrapper.forEach(dirMetadata.inputs, (bindConfig) => { this._bindDirectiveProperty(bindConfig, current, directiveBinderBuilder); }); } diff --git a/modules/angular2/src/mock/directive_resolver_mock.ts b/modules/angular2/src/mock/directive_resolver_mock.ts index 227dd0c5cd..08687a4f57 100644 --- a/modules/angular2/src/mock/directive_resolver_mock.ts +++ b/modules/angular2/src/mock/directive_resolver_mock.ts @@ -26,8 +26,8 @@ export class MockDirectiveResolver extends DirectiveResolver { return new ComponentMetadata({ selector: dm.selector, - properties: dm.properties, - events: dm.events, + inputs: dm.inputs, + outputs: dm.outputs, host: dm.host, bindings: bindings, exportAs: dm.exportAs, @@ -41,8 +41,8 @@ export class MockDirectiveResolver extends DirectiveResolver { return new DirectiveMetadata({ selector: dm.selector, - properties: dm.properties, - events: dm.events, + inputs: dm.inputs, + outputs: dm.outputs, host: dm.host, bindings: bindings, exportAs: dm.exportAs, diff --git a/modules/angular2/src/router/router_link.ts b/modules/angular2/src/router/router_link.ts index 76c5b11b7b..3d9344f35b 100644 --- a/modules/angular2/src/router/router_link.ts +++ b/modules/angular2/src/router/router_link.ts @@ -36,7 +36,7 @@ import {Instruction, stringifyInstruction} from './instruction'; */ @Directive({ selector: '[router-link]', - properties: ['routeParams: routerLink'], + inputs: ['routeParams: routerLink'], host: { '(click)': 'onClick()', '[attr.href]': 'visibleHref', diff --git a/modules/angular2/src/web_workers/shared/serializer.ts b/modules/angular2/src/web_workers/shared/serializer.ts index 6ea7826839..42b21cd975 100644 --- a/modules/angular2/src/web_workers/shared/serializer.ts +++ b/modules/angular2/src/web_workers/shared/serializer.ts @@ -367,8 +367,8 @@ export class Serializer { 'id': meta.id, 'selector': meta.selector, 'compileChildren': meta.compileChildren, - 'events': meta.events, - 'properties': meta.properties, + 'events': meta.outputs, + 'inputs': meta.inputs, 'readAttributes': meta.readAttributes, 'type': meta.type, 'callOnDestroy': meta.callOnDestroy, @@ -392,7 +392,7 @@ export class Serializer { hostProperties: this.objectToMap(obj['hostProperties']), hostListeners: this.objectToMap(obj['hostListeners']), hostAttributes: this.objectToMap(obj['hostAttributes']), - properties: obj['properties'], + inputs: obj['inputs'], readAttributes: obj['readAttributes'], type: obj['type'], exportAs: obj['exportAs'], @@ -402,7 +402,7 @@ export class Serializer { callOnInit: obj['callOnInit'], callAfterContentChecked: obj['callAfterContentChecked'], changeDetection: obj['changeDetection'], - events: obj['events'] + outputs: obj['events'] }); } } diff --git a/modules/angular2/test/compiler/change_definition_factory_spec.ts b/modules/angular2/test/compiler/change_definition_factory_spec.ts index 79838dd17b..bc658e129b 100644 --- a/modules/angular2/test/compiler/change_definition_factory_spec.ts +++ b/modules/angular2/test/compiler/change_definition_factory_spec.ts @@ -116,7 +116,7 @@ export function main() { var dirMeta = CompileDirectiveMetadata.create({ type: new CompileTypeMetadata({name: 'SomeDir'}), selector: '[dir-prop]', - properties: ['dirProp'] + inputs: ['dirProp'] }); var changeDetector = createChangeDetector('
    ', [dirMeta], 0); @@ -130,7 +130,7 @@ export function main() { var dirMeta = CompileDirectiveMetadata.create({ type: new CompileTypeMetadata({name: 'SomeDir'}), selector: '[dir-prop]', - properties: ['dirProp'] + inputs: ['dirProp'] }); var changeDetector = createChangeDetector('