refactor(LifecycleEvent): change from onInit to Lifecycle.onInit

BREAKING CHANGE

Closes #2928
This commit is contained in:
Misko Hevery 2015-07-04 15:04:50 +02:00 committed by Tobias Bosch
parent e1e7912ab2
commit b73ba68215
31 changed files with 245 additions and 250 deletions

View File

@ -13,12 +13,7 @@
export {
ComponentAnnotation,
DirectiveAnnotation,
LifecycleEvent,
onDestroy,
onChange,
onCheck,
onInit,
onAllChangesDone
LifecycleEvent
} from './src/core/annotations/annotations';
export {ViewAnnotation} from 'angular2/src/core/annotations/view';

View File

@ -6,10 +6,5 @@
export {
Component as ComponentAnnotation,
Directive as DirectiveAnnotation,
LifecycleEvent,
onDestroy,
onChange,
onCheck,
onInit,
onAllChangesDone
LifecycleEvent
} from '../annotations_impl/annotations';

View File

@ -933,12 +933,8 @@ export class Component extends Directive {
* - `onCheck`,
* - `onAllChangesDone`
*/
@CONST()
export class LifecycleEvent {
constructor(public name: string) {}
}
/**
export enum LifecycleEvent {
/**
* Notify a directive whenever a {@link View} that contains it is destroyed.
*
* ## Example
@ -946,7 +942,7 @@ export class LifecycleEvent {
* ```
* @Directive({
* ...,
* lifecycle: [onDestroy]
* lifecycle: [LifecycleEvent.onDestroy]
* })
* class ClassSet {
* onDestroy() {
@ -954,11 +950,12 @@ export class LifecycleEvent {
* }
* }
* ```
* @exportedAs angular2/annotations
*/
export const onDestroy: LifecycleEvent = CONST_EXPR(new LifecycleEvent("onDestroy"));
onDestroy,
/**
/**
* Notify a directive when any of its bindings have changed.
*
* This method is called right after the directive's bindings have been checked,
@ -975,7 +972,7 @@ export const onDestroy: LifecycleEvent = CONST_EXPR(new LifecycleEvent("onDestro
* 'propA',
* 'propB'
* ],
* lifecycle: [onChange]
* lifecycle: [LifecycleEvent.onChange]
* })
* class ClassSet {
* propA;
@ -991,10 +988,11 @@ export const onDestroy: LifecycleEvent = CONST_EXPR(new LifecycleEvent("onDestro
* }
* }
* ```
* @exportedAs angular2/annotations
*/
export const onChange: LifecycleEvent = CONST_EXPR(new LifecycleEvent("onChange"));
onChange,
/**
/**
* Notify a directive when it has been checked.
*
* This method is called right after the directive's bindings have been checked,
@ -1007,17 +1005,18 @@ export const onChange: LifecycleEvent = CONST_EXPR(new LifecycleEvent("onChange"
* ```
* @Directive({
* selector: '[class-set]',
* lifecycle: [onCheck]
* lifecycle: [LifecycleEvent.onCheck]
* })
* class ClassSet {
* onCheck() {
* }
* }
* ```
* @exportedAs angular2/annotations
*/
export const onCheck: LifecycleEvent = CONST_EXPR(new LifecycleEvent("onCheck"));
onCheck,
/**
/**
* Notify a directive when it has been checked the first itme.
*
* This method is called right after the directive's bindings have been checked,
@ -1030,17 +1029,18 @@ export const onCheck: LifecycleEvent = CONST_EXPR(new LifecycleEvent("onCheck"))
* ```
* @Directive({
* selector: '[class-set]',
* lifecycle: [onInit]
* lifecycle: [LifecycleEvent.onInit]
* })
* class ClassSet {
* onInit() {
* }
* }
* ```
* @exportedAs angular2/annotations
*/
export const onInit: LifecycleEvent = CONST_EXPR(new LifecycleEvent("onInit"));
onInit,
/**
/**
* Notify a directive when the bindings of all its children have been checked (whether they have
* changed or not).
*
@ -1049,7 +1049,7 @@ export const onInit: LifecycleEvent = CONST_EXPR(new LifecycleEvent("onInit"));
* ```
* @Directive({
* selector: '[class-set]',
* lifecycle: [onAllChangesDone]
* lifecycle: [LifecycleEvent.onAllChangesDone]
* })
* class ClassSet {
*
@ -1058,5 +1058,7 @@ export const onInit: LifecycleEvent = CONST_EXPR(new LifecycleEvent("onInit"));
*
* }
* ```
* @exportedAs angular2/annotations
*/
export const onAllChangesDone: LifecycleEvent = CONST_EXPR(new LifecycleEvent("onAllChangesDone"));
onAllChangesDone
}

View File

@ -11,15 +11,15 @@ bool hasLifecycleHook(LifecycleEvent e, type, Directive annotation) {
final List interfaces = reflector.interfaces(type);
var interface;
if (e == onChange) {
if (e == LifecycleEvent.onChange) {
interface = OnChange;
} else if (e == onDestroy) {
} else if (e == LifecycleEvent.onDestroy) {
interface = OnDestroy;
} else if (e == onAllChangesDone) {
} else if (e == LifecycleEvent.onAllChangesDone) {
interface = OnAllChangesDone;
} else if (e == onCheck) {
} else if (e == LifecycleEvent.onCheck) {
interface = OnCheck;
} else if (e == onInit) {
} else if (e == LifecycleEvent.onInit) {
interface = OnInit;
}

View File

@ -6,6 +6,20 @@ export function hasLifecycleHook(e: LifecycleEvent, type, annotation: Directive)
return annotation.lifecycle.indexOf(e) !== -1;
} else {
if (!(type instanceof Type)) return false;
return e.name in(<any>type).prototype;
var proto = (<any>type).prototype;
switch (e) {
case LifecycleEvent.onAllChangesDone:
return !!proto.onAllChangesDone;
case LifecycleEvent.onChange:
return !!proto.onChange;
case LifecycleEvent.onCheck:
return !!proto.onCheck;
case LifecycleEvent.onDestroy:
return !!proto.onDestroy;
case LifecycleEvent.onInit:
return !!proto.onInit;
default:
return false;
}
}
}

View File

@ -41,15 +41,7 @@ import * as avmModule from './view_manager';
import {ViewContainerRef} from './view_container_ref';
import {ElementRef} from './element_ref';
import {ProtoViewRef, ViewRef} from './view_ref';
import {
Directive,
Component,
onChange,
onDestroy,
onCheck,
onInit,
onAllChangesDone
} from 'angular2/src/core/annotations_impl/annotations';
import {Directive, Component, LifecycleEvent} from 'angular2/src/core/annotations_impl/annotations';
import {hasLifecycleHook} from './directive_lifecycle_reflector';
import {ChangeDetector, ChangeDetectorRef, Pipes} from 'angular2/change_detection';
import {QueryList} from './query_list';
@ -253,11 +245,11 @@ export class DirectiveBinding extends ResolvedBinding {
properties: ann.properties,
readAttributes: DirectiveBinding._readAttributes(deps),
callOnDestroy: hasLifecycleHook(onDestroy, rb.key.token, ann),
callOnChange: hasLifecycleHook(onChange, rb.key.token, ann),
callOnCheck: hasLifecycleHook(onCheck, rb.key.token, ann),
callOnInit: hasLifecycleHook(onInit, rb.key.token, ann),
callOnAllChangesDone: hasLifecycleHook(onAllChangesDone, rb.key.token, ann),
callOnDestroy: hasLifecycleHook(LifecycleEvent.onDestroy, rb.key.token, ann),
callOnChange: hasLifecycleHook(LifecycleEvent.onChange, rb.key.token, ann),
callOnCheck: hasLifecycleHook(LifecycleEvent.onCheck, rb.key.token, ann),
callOnInit: hasLifecycleHook(LifecycleEvent.onInit, rb.key.token, ann),
callOnAllChangesDone: hasLifecycleHook(LifecycleEvent.onAllChangesDone, rb.key.token, ann),
changeDetection: ann instanceof Component ? ann.changeDetection : null,

View File

@ -1,4 +1,4 @@
import {Directive, onCheck} from 'angular2/annotations';
import {Directive, LifecycleEvent} from 'angular2/annotations';
import {ElementRef} from 'angular2/core';
import {Pipes} from 'angular2/src/change_detection/pipes/pipes';
import {Pipe} from 'angular2/src/change_detection/pipes/pipe';
@ -28,7 +28,8 @@ import {ListWrapper, StringMapWrapper, isListLikeIterable} from 'angular2/src/fa
* </div>
* ```
*/
@Directive({selector: '[class]', lifecycle: [onCheck], properties: ['rawClass: class']})
@Directive(
{selector: '[class]', lifecycle: [LifecycleEvent.onCheck], properties: ['rawClass: class']})
export class CSSClass {
_pipe: Pipe;
_rawClass;

View File

@ -1,5 +1,12 @@
import {Directive} from 'angular2/annotations';
import {ViewContainerRef, ViewRef, ProtoViewRef, Pipes, onCheck, Pipe} from 'angular2/angular2';
import {
ViewContainerRef,
ViewRef,
ProtoViewRef,
Pipes,
LifecycleEvent,
Pipe
} from 'angular2/angular2';
import {isPresent, isBlank} from 'angular2/src/facade/lang';
/**
@ -32,7 +39,8 @@ import {isPresent, isBlank} from 'angular2/src/facade/lang';
* - `<li template="ng-for #item of items; #i = index">...</li>`
* - `<template ng-for #item [ng-for-of]="items" #i="index"><li>...</li></template>`
*/
@Directive({selector: '[ng-for][ng-for-of]', properties: ['ngForOf'], lifecycle: [onCheck]})
@Directive(
{selector: '[ng-for][ng-for-of]', properties: ['ngForOf'], lifecycle: [LifecycleEvent.onCheck]})
export class NgFor {
_ngForOf: any;
_pipe: Pipe;

View File

@ -1,4 +1,4 @@
import {Directive, onCheck} from 'angular2/annotations';
import {Directive, LifecycleEvent} from 'angular2/annotations';
import {ElementRef} from 'angular2/core';
import {Pipe} from 'angular2/src/change_detection/pipes/pipe';
import {Pipes} from 'angular2/src/change_detection/pipes/pipes';
@ -27,7 +27,11 @@ import {Renderer} from 'angular2/src/render/api';
* - `<div ng-style="{'text-align': alignEpr}"></div>`
* - `<div ng-style="styleExp"></div>`
*/
@Directive({selector: '[ng-style]', lifecycle: [onCheck], properties: ['rawStyle: ng-style']})
@Directive({
selector: '[ng-style]',
lifecycle: [LifecycleEvent.onCheck],
properties: ['rawStyle: ng-style']
})
export class NgStyle {
_pipe: Pipe;
_rawStyle;

View File

@ -1,4 +1,4 @@
import {Directive, onDestroy, onInit} from 'angular2/annotations';
import {Directive, LifecycleEvent} from 'angular2/angular2';
import {Inject, Ancestor, forwardRef, Binding} from 'angular2/di';
import {List, ListWrapper} from 'angular2/src/facade/collection';
import {CONST_EXPR} from 'angular2/src/facade/lang';
@ -52,7 +52,7 @@ const controlGroupBinding =
selector: '[ng-control-group]',
hostInjector: [controlGroupBinding],
properties: ['name: ng-control-group'],
lifecycle: [onInit, onDestroy],
lifecycle: [LifecycleEvent.onInit, LifecycleEvent.onDestroy],
exportAs: 'form'
})
export class NgControlGroup extends ControlContainer {

View File

@ -2,8 +2,7 @@ import {CONST_EXPR} from 'angular2/src/facade/lang';
import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async';
import {List, StringMapWrapper, StringMap} from 'angular2/src/facade/collection';
import {Directive, Query, onDestroy, onChange} from 'angular2/annotations';
import {QueryList} from 'angular2/core';
import {Directive, LifecycleEvent, Query, QueryList} from 'angular2/angular2';
import {forwardRef, Ancestor, Binding, Inject} from 'angular2/di';
import {ControlContainer} from './control_container';
@ -76,7 +75,7 @@ const controlNameBinding =
hostInjector: [controlNameBinding],
properties: ['name: ngControl', 'model: ngModel'],
events: ['update: ngModel'],
lifecycle: [onDestroy, onChange],
lifecycle: [LifecycleEvent.onDestroy, LifecycleEvent.onChange],
exportAs: 'form'
})
export class NgControlName extends NgControl {

View File

@ -2,8 +2,7 @@ import {CONST_EXPR} from 'angular2/src/facade/lang';
import {StringMapWrapper} from 'angular2/src/facade/collection';
import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async';
import {Directive, Query, onChange} from 'angular2/annotations';
import {QueryList} from 'angular2/core';
import {Directive, LifecycleEvent, Query, QueryList} from 'angular2/angular2';
import {forwardRef, Ancestor, Binding} from 'angular2/di';
import {NgControl} from './ng_control';
@ -64,7 +63,7 @@ const formControlBinding =
hostInjector: [formControlBinding],
properties: ['form: ngFormControl', 'model: ngModel'],
events: ['update: ngModel'],
lifecycle: [onChange],
lifecycle: [LifecycleEvent.onChange],
exportAs: 'form'
})
export class NgFormControl extends NgControl {

View File

@ -2,7 +2,7 @@ import {CONST_EXPR} from 'angular2/src/facade/lang';
import {List, ListWrapper} from 'angular2/src/facade/collection';
import {ObservableWrapper, EventEmitter} from 'angular2/src/facade/async';
import {Directive, onChange} from 'angular2/annotations';
import {Directive, LifecycleEvent} from 'angular2/angular2';
import {forwardRef, Binding} from 'angular2/di';
import {NgControl} from './ng_control';
import {NgControlGroup} from './ng_control_group';
@ -84,7 +84,7 @@ const formDirectiveBinding =
selector: '[ng-form-model]',
hostInjector: [formDirectiveBinding],
properties: ['form: ng-form-model'],
lifecycle: [onChange],
lifecycle: [LifecycleEvent.onChange],
host: {
'(submit)': 'onSubmit()',
},

View File

@ -2,8 +2,7 @@ import {CONST_EXPR} from 'angular2/src/facade/lang';
import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async';
import {StringMapWrapper} from 'angular2/src/facade/collection';
import {Directive, Query, onChange} from 'angular2/annotations';
import {QueryList} from 'angular2/core';
import {Directive, LifecycleEvent, QueryList, Query} from 'angular2/angular2';
import {forwardRef, Ancestor, Binding} from 'angular2/di';
import {NgControl} from './ng_control';
@ -34,7 +33,7 @@ const formControlBinding = CONST_EXPR(new Binding(NgControl, {toAlias: forwardRe
hostInjector: [formControlBinding],
properties: ['model: ngModel'],
events: ['update: ngModel'],
lifecycle: [onChange],
lifecycle: [LifecycleEvent.onChange],
exportAs: 'form'
})
export class NgModel extends NgControl {

View File

@ -1,6 +1,5 @@
import {Renderer} from 'angular2/render';
import {ElementRef, QueryList} from 'angular2/core';
import {Directive, Query, onDestroy, onChange} from 'angular2/annotations';
import {ElementRef, QueryList, Directive, Query} from 'angular2/angular2';
import {NgControl} from './ng_control';
import {ControlValueAccessor} from './control_value_accessor';

View File

@ -261,7 +261,7 @@ class _DirectiveMetadataVisitor extends Object
'$lifecycleValue');
}
ListLiteral l = lifecycleValue;
var lifecycleEvents = l.elements.map((s) => s.toSource());
var lifecycleEvents = l.elements.map((s) => s.toSource().split('.').last);
_callOnDestroy = lifecycleEvents.contains("onDestroy");
_callOnChange = lifecycleEvents.contains("onChange");
_callOnCheck = lifecycleEvents.contains("onCheck");

View File

@ -19,7 +19,7 @@ main() {
it("should be true when the lifecycle includes onChange", () {
expect(metadata(DirectiveNoHooks,
new Directive(lifecycle: [onChange])).callOnChange).toBe(true);
new Directive(lifecycle: [LifecycleEvent.onChange])).callOnChange).toBe(true);
});
it("should be false otherwise", () {
@ -41,7 +41,7 @@ main() {
it("should be true when the lifecycle includes onDestroy", () {
expect(metadata(DirectiveNoHooks,
new Directive(lifecycle: [onDestroy])).callOnDestroy).toBe(true);
new Directive(lifecycle: [LifecycleEvent.onDestroy])).callOnDestroy).toBe(true);
});
it("should be false otherwise", () {
@ -59,7 +59,7 @@ main() {
it("should be true when the lifecycle includes onCheck", () {
expect(metadata(DirectiveNoHooks,
new Directive(lifecycle: [onCheck])).callOnCheck).toBe(true);
new Directive(lifecycle: [LifecycleEvent.onCheck])).callOnCheck).toBe(true);
});
it("should be false otherwise", () {
@ -77,7 +77,7 @@ main() {
it("should be true when the lifecycle includes onInit", () {
expect(metadata(DirectiveNoHooks,
new Directive(lifecycle: [onInit])).callOnInit).toBe(true);
new Directive(lifecycle: [LifecycleEvent.onInit])).callOnInit).toBe(true);
});
it("should be false otherwise", () {
@ -94,7 +94,7 @@ main() {
it("should be true when the lifecycle includes onAllChangesDone", () {
expect(metadata(DirectiveNoHooks, new Directive(
lifecycle: [onAllChangesDone])).callOnAllChangesDone).toBe(true);
lifecycle: [LifecycleEvent.onAllChangesDone])).callOnAllChangesDone).toBe(true);
});
it("should be false otherwise", () {

View File

@ -14,14 +14,7 @@ import {
proxy
} from 'angular2/test_lib';
import {
Directive,
onChange,
onDestroy,
onCheck,
onInit,
onAllChangesDone
} from 'angular2/src/core/annotations_impl/annotations';
import {Directive, LifecycleEvent} from 'angular2/src/core/annotations_impl/annotations';
import {DirectiveBinding} from 'angular2/src/core/compiler/element_injector';
export function main() {
@ -37,7 +30,8 @@ export function main() {
});
it("should be true when the lifecycle includes onChange", () => {
expect(metadata(DirectiveNoHooks, new Directive({lifecycle: [onChange]})).callOnChange)
expect(metadata(DirectiveNoHooks, new Directive({lifecycle: [LifecycleEvent.onChange]}))
.callOnChange)
.toBe(true);
});
@ -57,7 +51,8 @@ export function main() {
});
it("should be true when the lifecycle includes onDestroy", () => {
expect(metadata(DirectiveNoHooks, new Directive({lifecycle: [onDestroy]})).callOnDestroy)
expect(metadata(DirectiveNoHooks, new Directive({lifecycle: [LifecycleEvent.onDestroy]}))
.callOnDestroy)
.toBe(true);
});
@ -72,7 +67,8 @@ export function main() {
});
it("should be true when the lifecycle includes onDestroy", () => {
expect(metadata(DirectiveNoHooks, new Directive({lifecycle: [onInit]})).callOnInit)
expect(metadata(DirectiveNoHooks, new Directive({lifecycle: [LifecycleEvent.onInit]}))
.callOnInit)
.toBe(true);
});
@ -86,7 +82,8 @@ export function main() {
});
it("should be true when the lifecycle includes onCheck", () => {
expect(metadata(DirectiveNoHooks, new Directive({lifecycle: [onCheck]})).callOnCheck)
expect(metadata(DirectiveNoHooks, new Directive({lifecycle: [LifecycleEvent.onCheck]}))
.callOnCheck)
.toBe(true);
});
@ -102,7 +99,8 @@ export function main() {
});
it("should be true when the lifecycle includes onAllChangesDone", () => {
expect(metadata(DirectiveNoHooks, new Directive({lifecycle: [onAllChangesDone]}))
expect(metadata(DirectiveNoHooks,
new Directive({lifecycle: [LifecycleEvent.onAllChangesDone]}))
.callOnAllChangesDone)
.toBe(true);
});

View File

@ -21,7 +21,7 @@ import {
import {Injector} from 'angular2/di';
import {NgIf} from 'angular2/directives';
import {Component, View, onDestroy} from 'angular2/annotations';
import {Component, View, LifecycleEvent} from 'angular2/annotations';
import * as viewAnn from 'angular2/src/core/annotations_impl/view';
import {DynamicComponentLoader} from 'angular2/src/core/compiler/dynamic_component_loader';
import {ElementRef} from 'angular2/src/core/compiler/element_ref';
@ -267,7 +267,7 @@ class DynamicallyCreatedComponentService {}
@Component({
selector: 'hello-cmp',
viewInjector: [DynamicallyCreatedComponentService],
lifecycle: [onDestroy]
lifecycle: [LifecycleEvent.onDestroy]
})
@View({template: "{{greeting}}"})
class DynamicallyCreatedCmp {

View File

@ -38,7 +38,7 @@ import {
Query,
Component,
Directive,
onDestroy
LifecycleEvent
} from 'angular2/annotations';
import {bind, Injector, Binding, Optional, Inject, Injectable, Self, Parent, Ancestor, Unbounded, InjectMetadata, ParentMetadata} from 'angular2/di';
import {AppProtoView, AppView} from 'angular2/src/core/compiler/view';
@ -831,7 +831,7 @@ export function main() {
it("should call onDestroy on directives subscribed to this event", () => {
var inj = injector(ListWrapper.concat(
[DirectiveBinding.createFromType(DirectiveWithDestroy,
new dirAnn.Directive({lifecycle: [onDestroy]}))],
new dirAnn.Directive({lifecycle: [LifecycleEvent.onDestroy]}))],
extraBindings));
var destroy = inj.get(DirectiveWithDestroy);
inj.dehydrate();

View File

@ -195,7 +195,7 @@ class NoPropertyAccess {
@Component(selector: 'on-change',
// TODO: needed because of https://github.com/angular/angular/issues/2120
lifecycle: const [onChange], properties: const ['prop'])
lifecycle: const [LifecycleEvent.onChange], properties: const ['prop'])
@View(template: '')
class OnChangeComponent implements OnChange {
Map changes;

View File

@ -14,15 +14,7 @@ import {
} from 'angular2/test_lib';
import {ListWrapper} from 'angular2/src/facade/collection';
import {
Directive,
Component,
View,
onCheck,
onInit,
onChange,
onAllChangesDone
} from 'angular2/angular2';
import {Directive, Component, View, LifecycleEvent} from 'angular2/angular2';
import * as viewAnn from 'angular2/src/core/annotations_impl/view';
export function main() {
@ -62,7 +54,12 @@ export function main() {
@Directive({
selector: "[lifecycle]",
properties: ['field'],
lifecycle: [onChange, onCheck, onInit, onAllChangesDone]
lifecycle: [
LifecycleEvent.onChange,
LifecycleEvent.onCheck,
LifecycleEvent.onInit,
LifecycleEvent.onAllChangesDone
]
})
class LifecycleDir {
field;

View File

@ -8,11 +8,7 @@ import 'package:angular2/angular2.dart'
Directive,
View,
NgElement,
onChange,
onDestroy,
onInit,
onCheck,
onAllChangesDone;
LifecycleEvent;
var _visited = false;
void initReflector(reflector) {

View File

@ -8,11 +8,7 @@ import 'package:angular2/angular2.dart'
Directive,
View,
NgElement,
onChange,
onDestroy,
onInit,
onCheck,
onAllChangesDone;
LifecycleEvent;
var _visited = false;
void initReflector(reflector) {

View File

@ -8,11 +8,7 @@ import 'package:angular2/angular2.dart'
Directive,
View,
NgElement,
onChange,
onDestroy,
onInit,
onCheck,
onAllChangesDone;
LifecycleEvent;
var _visited = false;
void initReflector(reflector) {

View File

@ -8,11 +8,7 @@ import 'package:angular2/angular2.dart'
Directive,
View,
NgElement,
onChange,
onDestroy,
onInit,
onCheck,
onAllChangesDone;
LifecycleEvent;
var _visited = false;
void initReflector(reflector) {
@ -24,7 +20,8 @@ void initReflector(reflector) {
'parameters': const [const []],
'annotations': const [
const Component(
lifecycle: [onChange, onDestroy, onInit, onCheck, onAllChangesDone])
lifecycle: [LifecycleEvent.onChange, LifecycleEvent.onDestroy, LifecycleEvent.onInit,
LifecycleEvent.onCheck, LifecycleEvent.onAllChangesDone])
]
});
}

View File

@ -1,4 +1,4 @@
import {Component, View, onChange} from 'angular2/angular2';
import {Component, View, LifecycleEvent} from 'angular2/angular2';
import {isPresent} from 'angular2/src/facade/lang';
@ -13,7 +13,7 @@ export class MdButton {
selector: '[md-button][href]',
properties: ['disabled'],
host: {'(click)': 'onClick($event)', '[tabIndex]': 'tabIndex'},
lifecycle: [onChange]
lifecycle: [LifecycleEvent.onChange]
})
@View({templateUrl: 'angular2_material/src/components/button/button.html'})
export class MdAnchor {

View File

@ -1,4 +1,4 @@
import {Component, View, Parent, onDestroy, onChange, onAllChangesDone} from 'angular2/angular2';
import {Component, View, Parent, LifecycleEvent} from 'angular2/angular2';
import {ListWrapper} from 'angular2/src/facade/collection';
import {StringWrapper, isPresent, isString, NumberWrapper} from 'angular2/src/facade/lang';
@ -14,7 +14,7 @@ import {Math} from 'angular2/src/facade/math';
@Component({
selector: 'md-grid-list',
properties: ['cols', 'rowHeight', 'gutterSize'],
lifecycle: [onAllChangesDone]
lifecycle: [LifecycleEvent.onAllChangesDone]
})
@View({templateUrl: 'angular2_material/src/components/grid_list/grid_list.html'})
export class MdGridList {
@ -221,7 +221,7 @@ export class MdGridList {
'[style.paddingTop]': 'stylePaddingTop',
'[attr.role]': '"listitem"'
},
lifecycle: [onDestroy, onChange]
lifecycle: [LifecycleEvent.onDestroy, LifecycleEvent.onChange]
})
@View({templateUrl: 'angular2_material/src/components/grid_list/grid_tile.html'})
export class MdGridTile {

View File

@ -1,4 +1,4 @@
import {Directive, onAllChangesDone, Attribute, Parent} from 'angular2/angular2';
import {Directive, LifecycleEvent, Attribute, Parent} from 'angular2/angular2';
import {ObservableWrapper, EventEmitter} from 'angular2/src/facade/async';
@ -9,7 +9,7 @@ import {ObservableWrapper, EventEmitter} from 'angular2/src/facade/async';
@Directive({
selector: 'md-input-container',
lifecycle: [onAllChangesDone],
lifecycle: [LifecycleEvent.onAllChangesDone],
host:
{'[class.md-input-has-value]': 'inputHasValue', '[class.md-input-focused]': 'inputHasFocus'}
})

View File

@ -1,11 +1,11 @@
import {Component, onChange, View, Attribute} from 'angular2/angular2';
import {Component, LifecycleEvent, View, Attribute} from 'angular2/angular2';
import {isPresent, isBlank} from 'angular2/src/facade/lang';
import {Math} from 'angular2/src/facade/math';
@Component({
selector: 'md-progress-linear',
lifecycle: [onChange],
lifecycle: [LifecycleEvent.onChange],
properties: ['value', 'bufferValue'],
host: {
'[attr.role]': '"progressbar"',

View File

@ -1,4 +1,12 @@
import {Component, View, onChange, Parent, Ancestor, Attribute, Optional} from 'angular2/angular2';
import {
Component,
View,
LifecycleEvent,
Parent,
Ancestor,
Attribute,
Optional
} from 'angular2/angular2';
import {isPresent, StringWrapper, NumberWrapper} from 'angular2/src/facade/lang';
import {ObservableWrapper, EventEmitter} from 'angular2/src/facade/async';
@ -24,7 +32,7 @@ var _uniqueIdCounter: number = 0;
@Component({
selector: 'md-radio-group',
lifecycle: [onChange],
lifecycle: [LifecycleEvent.onChange],
events: ['change'],
properties: ['disabled', 'value'],
host: {
@ -179,7 +187,7 @@ export class MdRadioGroup {
@Component({
selector: 'md-radio-button',
lifecycle: [onChange],
lifecycle: [LifecycleEvent.onChange],
properties: ['id', 'name', 'value', 'checked', 'disabled'],
host: {
'(keydown)': 'onKeydown($event)',