refactor(LifecycleEvent): change from onInit to Lifecycle.onInit
BREAKING CHANGE Closes #2928
This commit is contained in:
parent
e1e7912ab2
commit
b73ba68215
|
@ -13,12 +13,7 @@
|
||||||
export {
|
export {
|
||||||
ComponentAnnotation,
|
ComponentAnnotation,
|
||||||
DirectiveAnnotation,
|
DirectiveAnnotation,
|
||||||
LifecycleEvent,
|
LifecycleEvent
|
||||||
onDestroy,
|
|
||||||
onChange,
|
|
||||||
onCheck,
|
|
||||||
onInit,
|
|
||||||
onAllChangesDone
|
|
||||||
} from './src/core/annotations/annotations';
|
} from './src/core/annotations/annotations';
|
||||||
|
|
||||||
export {ViewAnnotation} from 'angular2/src/core/annotations/view';
|
export {ViewAnnotation} from 'angular2/src/core/annotations/view';
|
||||||
|
|
|
@ -6,10 +6,5 @@
|
||||||
export {
|
export {
|
||||||
Component as ComponentAnnotation,
|
Component as ComponentAnnotation,
|
||||||
Directive as DirectiveAnnotation,
|
Directive as DirectiveAnnotation,
|
||||||
LifecycleEvent,
|
LifecycleEvent
|
||||||
onDestroy,
|
|
||||||
onChange,
|
|
||||||
onCheck,
|
|
||||||
onInit,
|
|
||||||
onAllChangesDone
|
|
||||||
} from '../annotations_impl/annotations';
|
} from '../annotations_impl/annotations';
|
||||||
|
|
|
@ -933,130 +933,132 @@ export class Component extends Directive {
|
||||||
* - `onCheck`,
|
* - `onCheck`,
|
||||||
* - `onAllChangesDone`
|
* - `onAllChangesDone`
|
||||||
*/
|
*/
|
||||||
@CONST()
|
export enum LifecycleEvent {
|
||||||
export class LifecycleEvent {
|
/**
|
||||||
constructor(public name: string) {}
|
* Notify a directive whenever a {@link View} that contains it is destroyed.
|
||||||
|
*
|
||||||
|
* ## Example
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* @Directive({
|
||||||
|
* ...,
|
||||||
|
* lifecycle: [LifecycleEvent.onDestroy]
|
||||||
|
* })
|
||||||
|
* class ClassSet {
|
||||||
|
* onDestroy() {
|
||||||
|
* // invoked to notify directive of the containing view destruction.
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @exportedAs angular2/annotations
|
||||||
|
*/
|
||||||
|
onDestroy,
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify a directive when any of its bindings have changed.
|
||||||
|
*
|
||||||
|
* This method is called right after the directive's bindings have been checked,
|
||||||
|
* and before any of its children's bindings have been checked.
|
||||||
|
*
|
||||||
|
* It is invoked only if at least one of the directive's bindings has changed.
|
||||||
|
*
|
||||||
|
* ## Example:
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* @Directive({
|
||||||
|
* selector: '[class-set]',
|
||||||
|
* properties: [
|
||||||
|
* 'propA',
|
||||||
|
* 'propB'
|
||||||
|
* ],
|
||||||
|
* lifecycle: [LifecycleEvent.onChange]
|
||||||
|
* })
|
||||||
|
* class ClassSet {
|
||||||
|
* propA;
|
||||||
|
* propB;
|
||||||
|
* onChange(changes:{[idx: string, PropertyUpdate]}) {
|
||||||
|
* // This will get called after any of the properties have been updated.
|
||||||
|
* if (changes['propA']) {
|
||||||
|
* // if propA was updated
|
||||||
|
* }
|
||||||
|
* if (changes['propA']) {
|
||||||
|
* // if propB was updated
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @exportedAs angular2/annotations
|
||||||
|
*/
|
||||||
|
onChange,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify a directive when it has been checked.
|
||||||
|
*
|
||||||
|
* This method is called right after the directive's bindings have been checked,
|
||||||
|
* and before any of its children's bindings have been checked.
|
||||||
|
*
|
||||||
|
* It is invoked every time even when none of the directive's bindings has changed.
|
||||||
|
*
|
||||||
|
* ## Example:
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* @Directive({
|
||||||
|
* selector: '[class-set]',
|
||||||
|
* lifecycle: [LifecycleEvent.onCheck]
|
||||||
|
* })
|
||||||
|
* class ClassSet {
|
||||||
|
* onCheck() {
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @exportedAs angular2/annotations
|
||||||
|
*/
|
||||||
|
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,
|
||||||
|
* and before any of its children's bindings have been checked.
|
||||||
|
*
|
||||||
|
* It is invoked only once.
|
||||||
|
*
|
||||||
|
* ## Example:
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* @Directive({
|
||||||
|
* selector: '[class-set]',
|
||||||
|
* lifecycle: [LifecycleEvent.onInit]
|
||||||
|
* })
|
||||||
|
* class ClassSet {
|
||||||
|
* onInit() {
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @exportedAs angular2/annotations
|
||||||
|
*/
|
||||||
|
onInit,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify a directive when the bindings of all its children have been checked (whether they have
|
||||||
|
* changed or not).
|
||||||
|
*
|
||||||
|
* ## Example:
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* @Directive({
|
||||||
|
* selector: '[class-set]',
|
||||||
|
* lifecycle: [LifecycleEvent.onAllChangesDone]
|
||||||
|
* })
|
||||||
|
* class ClassSet {
|
||||||
|
*
|
||||||
|
* onAllChangesDone() {
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @exportedAs angular2/annotations
|
||||||
|
*/
|
||||||
|
onAllChangesDone
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Notify a directive whenever a {@link View} that contains it is destroyed.
|
|
||||||
*
|
|
||||||
* ## Example
|
|
||||||
*
|
|
||||||
* ```
|
|
||||||
* @Directive({
|
|
||||||
* ...,
|
|
||||||
* lifecycle: [onDestroy]
|
|
||||||
* })
|
|
||||||
* class ClassSet {
|
|
||||||
* onDestroy() {
|
|
||||||
* // invoked to notify directive of the containing view destruction.
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
export const onDestroy: LifecycleEvent = CONST_EXPR(new LifecycleEvent("onDestroy"));
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Notify a directive when any of its bindings have changed.
|
|
||||||
*
|
|
||||||
* This method is called right after the directive's bindings have been checked,
|
|
||||||
* and before any of its children's bindings have been checked.
|
|
||||||
*
|
|
||||||
* It is invoked only if at least one of the directive's bindings has changed.
|
|
||||||
*
|
|
||||||
* ## Example:
|
|
||||||
*
|
|
||||||
* ```
|
|
||||||
* @Directive({
|
|
||||||
* selector: '[class-set]',
|
|
||||||
* properties: [
|
|
||||||
* 'propA',
|
|
||||||
* 'propB'
|
|
||||||
* ],
|
|
||||||
* lifecycle: [onChange]
|
|
||||||
* })
|
|
||||||
* class ClassSet {
|
|
||||||
* propA;
|
|
||||||
* propB;
|
|
||||||
* onChange(changes:{[idx: string, PropertyUpdate]}) {
|
|
||||||
* // This will get called after any of the properties have been updated.
|
|
||||||
* if (changes['propA']) {
|
|
||||||
* // if propA was updated
|
|
||||||
* }
|
|
||||||
* if (changes['propA']) {
|
|
||||||
* // if propB was updated
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
export const onChange: LifecycleEvent = CONST_EXPR(new LifecycleEvent("onChange"));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Notify a directive when it has been checked.
|
|
||||||
*
|
|
||||||
* This method is called right after the directive's bindings have been checked,
|
|
||||||
* and before any of its children's bindings have been checked.
|
|
||||||
*
|
|
||||||
* It is invoked every time even when none of the directive's bindings has changed.
|
|
||||||
*
|
|
||||||
* ## Example:
|
|
||||||
*
|
|
||||||
* ```
|
|
||||||
* @Directive({
|
|
||||||
* selector: '[class-set]',
|
|
||||||
* lifecycle: [onCheck]
|
|
||||||
* })
|
|
||||||
* class ClassSet {
|
|
||||||
* onCheck() {
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
export const onCheck: LifecycleEvent = CONST_EXPR(new LifecycleEvent("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,
|
|
||||||
* and before any of its children's bindings have been checked.
|
|
||||||
*
|
|
||||||
* It is invoked only once.
|
|
||||||
*
|
|
||||||
* ## Example:
|
|
||||||
*
|
|
||||||
* ```
|
|
||||||
* @Directive({
|
|
||||||
* selector: '[class-set]',
|
|
||||||
* lifecycle: [onInit]
|
|
||||||
* })
|
|
||||||
* class ClassSet {
|
|
||||||
* onInit() {
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
export const onInit: LifecycleEvent = CONST_EXPR(new LifecycleEvent("onInit"));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Notify a directive when the bindings of all its children have been checked (whether they have
|
|
||||||
* changed or not).
|
|
||||||
*
|
|
||||||
* ## Example:
|
|
||||||
*
|
|
||||||
* ```
|
|
||||||
* @Directive({
|
|
||||||
* selector: '[class-set]',
|
|
||||||
* lifecycle: [onAllChangesDone]
|
|
||||||
* })
|
|
||||||
* class ClassSet {
|
|
||||||
*
|
|
||||||
* onAllChangesDone() {
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
export const onAllChangesDone: LifecycleEvent = CONST_EXPR(new LifecycleEvent("onAllChangesDone"));
|
|
||||||
|
|
|
@ -11,15 +11,15 @@ bool hasLifecycleHook(LifecycleEvent e, type, Directive annotation) {
|
||||||
final List interfaces = reflector.interfaces(type);
|
final List interfaces = reflector.interfaces(type);
|
||||||
var interface;
|
var interface;
|
||||||
|
|
||||||
if (e == onChange) {
|
if (e == LifecycleEvent.onChange) {
|
||||||
interface = OnChange;
|
interface = OnChange;
|
||||||
} else if (e == onDestroy) {
|
} else if (e == LifecycleEvent.onDestroy) {
|
||||||
interface = OnDestroy;
|
interface = OnDestroy;
|
||||||
} else if (e == onAllChangesDone) {
|
} else if (e == LifecycleEvent.onAllChangesDone) {
|
||||||
interface = OnAllChangesDone;
|
interface = OnAllChangesDone;
|
||||||
} else if (e == onCheck) {
|
} else if (e == LifecycleEvent.onCheck) {
|
||||||
interface = OnCheck;
|
interface = OnCheck;
|
||||||
} else if (e == onInit) {
|
} else if (e == LifecycleEvent.onInit) {
|
||||||
interface = OnInit;
|
interface = OnInit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,20 @@ export function hasLifecycleHook(e: LifecycleEvent, type, annotation: Directive)
|
||||||
return annotation.lifecycle.indexOf(e) !== -1;
|
return annotation.lifecycle.indexOf(e) !== -1;
|
||||||
} else {
|
} else {
|
||||||
if (!(type instanceof Type)) return false;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -41,15 +41,7 @@ import * as avmModule from './view_manager';
|
||||||
import {ViewContainerRef} from './view_container_ref';
|
import {ViewContainerRef} from './view_container_ref';
|
||||||
import {ElementRef} from './element_ref';
|
import {ElementRef} from './element_ref';
|
||||||
import {ProtoViewRef, ViewRef} from './view_ref';
|
import {ProtoViewRef, ViewRef} from './view_ref';
|
||||||
import {
|
import {Directive, Component, LifecycleEvent} from 'angular2/src/core/annotations_impl/annotations';
|
||||||
Directive,
|
|
||||||
Component,
|
|
||||||
onChange,
|
|
||||||
onDestroy,
|
|
||||||
onCheck,
|
|
||||||
onInit,
|
|
||||||
onAllChangesDone
|
|
||||||
} from 'angular2/src/core/annotations_impl/annotations';
|
|
||||||
import {hasLifecycleHook} from './directive_lifecycle_reflector';
|
import {hasLifecycleHook} from './directive_lifecycle_reflector';
|
||||||
import {ChangeDetector, ChangeDetectorRef, Pipes} from 'angular2/change_detection';
|
import {ChangeDetector, ChangeDetectorRef, Pipes} from 'angular2/change_detection';
|
||||||
import {QueryList} from './query_list';
|
import {QueryList} from './query_list';
|
||||||
|
@ -253,11 +245,11 @@ export class DirectiveBinding extends ResolvedBinding {
|
||||||
properties: ann.properties,
|
properties: ann.properties,
|
||||||
readAttributes: DirectiveBinding._readAttributes(deps),
|
readAttributes: DirectiveBinding._readAttributes(deps),
|
||||||
|
|
||||||
callOnDestroy: hasLifecycleHook(onDestroy, rb.key.token, ann),
|
callOnDestroy: hasLifecycleHook(LifecycleEvent.onDestroy, rb.key.token, ann),
|
||||||
callOnChange: hasLifecycleHook(onChange, rb.key.token, ann),
|
callOnChange: hasLifecycleHook(LifecycleEvent.onChange, rb.key.token, ann),
|
||||||
callOnCheck: hasLifecycleHook(onCheck, rb.key.token, ann),
|
callOnCheck: hasLifecycleHook(LifecycleEvent.onCheck, rb.key.token, ann),
|
||||||
callOnInit: hasLifecycleHook(onInit, rb.key.token, ann),
|
callOnInit: hasLifecycleHook(LifecycleEvent.onInit, rb.key.token, ann),
|
||||||
callOnAllChangesDone: hasLifecycleHook(onAllChangesDone, rb.key.token, ann),
|
callOnAllChangesDone: hasLifecycleHook(LifecycleEvent.onAllChangesDone, rb.key.token, ann),
|
||||||
|
|
||||||
changeDetection: ann instanceof Component ? ann.changeDetection : null,
|
changeDetection: ann instanceof Component ? ann.changeDetection : null,
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {Directive, onCheck} from 'angular2/annotations';
|
import {Directive, LifecycleEvent} from 'angular2/annotations';
|
||||||
import {ElementRef} from 'angular2/core';
|
import {ElementRef} from 'angular2/core';
|
||||||
import {Pipes} from 'angular2/src/change_detection/pipes/pipes';
|
import {Pipes} from 'angular2/src/change_detection/pipes/pipes';
|
||||||
import {Pipe} from 'angular2/src/change_detection/pipes/pipe';
|
import {Pipe} from 'angular2/src/change_detection/pipes/pipe';
|
||||||
|
@ -28,7 +28,8 @@ import {ListWrapper, StringMapWrapper, isListLikeIterable} from 'angular2/src/fa
|
||||||
* </div>
|
* </div>
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@Directive({selector: '[class]', lifecycle: [onCheck], properties: ['rawClass: class']})
|
@Directive(
|
||||||
|
{selector: '[class]', lifecycle: [LifecycleEvent.onCheck], properties: ['rawClass: class']})
|
||||||
export class CSSClass {
|
export class CSSClass {
|
||||||
_pipe: Pipe;
|
_pipe: Pipe;
|
||||||
_rawClass;
|
_rawClass;
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
import {Directive} from 'angular2/annotations';
|
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';
|
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>`
|
* - `<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'], lifecycle: [onCheck]})
|
@Directive(
|
||||||
|
{selector: '[ng-for][ng-for-of]', properties: ['ngForOf'], lifecycle: [LifecycleEvent.onCheck]})
|
||||||
export class NgFor {
|
export class NgFor {
|
||||||
_ngForOf: any;
|
_ngForOf: any;
|
||||||
_pipe: Pipe;
|
_pipe: Pipe;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {Directive, onCheck} from 'angular2/annotations';
|
import {Directive, LifecycleEvent} from 'angular2/annotations';
|
||||||
import {ElementRef} from 'angular2/core';
|
import {ElementRef} from 'angular2/core';
|
||||||
import {Pipe} from 'angular2/src/change_detection/pipes/pipe';
|
import {Pipe} from 'angular2/src/change_detection/pipes/pipe';
|
||||||
import {Pipes} from 'angular2/src/change_detection/pipes/pipes';
|
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="{'text-align': alignEpr}"></div>`
|
||||||
* - `<div ng-style="styleExp"></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 {
|
export class NgStyle {
|
||||||
_pipe: Pipe;
|
_pipe: Pipe;
|
||||||
_rawStyle;
|
_rawStyle;
|
||||||
|
|
|
@ -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 {Inject, Ancestor, forwardRef, Binding} from 'angular2/di';
|
||||||
import {List, ListWrapper} from 'angular2/src/facade/collection';
|
import {List, ListWrapper} from 'angular2/src/facade/collection';
|
||||||
import {CONST_EXPR} from 'angular2/src/facade/lang';
|
import {CONST_EXPR} from 'angular2/src/facade/lang';
|
||||||
|
@ -52,7 +52,7 @@ const controlGroupBinding =
|
||||||
selector: '[ng-control-group]',
|
selector: '[ng-control-group]',
|
||||||
hostInjector: [controlGroupBinding],
|
hostInjector: [controlGroupBinding],
|
||||||
properties: ['name: ng-control-group'],
|
properties: ['name: ng-control-group'],
|
||||||
lifecycle: [onInit, onDestroy],
|
lifecycle: [LifecycleEvent.onInit, LifecycleEvent.onDestroy],
|
||||||
exportAs: 'form'
|
exportAs: 'form'
|
||||||
})
|
})
|
||||||
export class NgControlGroup extends ControlContainer {
|
export class NgControlGroup extends ControlContainer {
|
||||||
|
|
|
@ -2,8 +2,7 @@ import {CONST_EXPR} from 'angular2/src/facade/lang';
|
||||||
import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async';
|
import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async';
|
||||||
import {List, StringMapWrapper, StringMap} from 'angular2/src/facade/collection';
|
import {List, StringMapWrapper, StringMap} from 'angular2/src/facade/collection';
|
||||||
|
|
||||||
import {Directive, Query, onDestroy, onChange} from 'angular2/annotations';
|
import {Directive, LifecycleEvent, Query, QueryList} from 'angular2/angular2';
|
||||||
import {QueryList} from 'angular2/core';
|
|
||||||
import {forwardRef, Ancestor, Binding, Inject} from 'angular2/di';
|
import {forwardRef, Ancestor, Binding, Inject} from 'angular2/di';
|
||||||
|
|
||||||
import {ControlContainer} from './control_container';
|
import {ControlContainer} from './control_container';
|
||||||
|
@ -76,7 +75,7 @@ const controlNameBinding =
|
||||||
hostInjector: [controlNameBinding],
|
hostInjector: [controlNameBinding],
|
||||||
properties: ['name: ngControl', 'model: ngModel'],
|
properties: ['name: ngControl', 'model: ngModel'],
|
||||||
events: ['update: ngModel'],
|
events: ['update: ngModel'],
|
||||||
lifecycle: [onDestroy, onChange],
|
lifecycle: [LifecycleEvent.onDestroy, LifecycleEvent.onChange],
|
||||||
exportAs: 'form'
|
exportAs: 'form'
|
||||||
})
|
})
|
||||||
export class NgControlName extends NgControl {
|
export class NgControlName extends NgControl {
|
||||||
|
|
|
@ -2,8 +2,7 @@ import {CONST_EXPR} from 'angular2/src/facade/lang';
|
||||||
import {StringMapWrapper} from 'angular2/src/facade/collection';
|
import {StringMapWrapper} from 'angular2/src/facade/collection';
|
||||||
import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async';
|
import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async';
|
||||||
|
|
||||||
import {Directive, Query, onChange} from 'angular2/annotations';
|
import {Directive, LifecycleEvent, Query, QueryList} from 'angular2/angular2';
|
||||||
import {QueryList} from 'angular2/core';
|
|
||||||
import {forwardRef, Ancestor, Binding} from 'angular2/di';
|
import {forwardRef, Ancestor, Binding} from 'angular2/di';
|
||||||
|
|
||||||
import {NgControl} from './ng_control';
|
import {NgControl} from './ng_control';
|
||||||
|
@ -64,7 +63,7 @@ const formControlBinding =
|
||||||
hostInjector: [formControlBinding],
|
hostInjector: [formControlBinding],
|
||||||
properties: ['form: ngFormControl', 'model: ngModel'],
|
properties: ['form: ngFormControl', 'model: ngModel'],
|
||||||
events: ['update: ngModel'],
|
events: ['update: ngModel'],
|
||||||
lifecycle: [onChange],
|
lifecycle: [LifecycleEvent.onChange],
|
||||||
exportAs: 'form'
|
exportAs: 'form'
|
||||||
})
|
})
|
||||||
export class NgFormControl extends NgControl {
|
export class NgFormControl extends NgControl {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import {CONST_EXPR} from 'angular2/src/facade/lang';
|
||||||
import {List, ListWrapper} from 'angular2/src/facade/collection';
|
import {List, ListWrapper} from 'angular2/src/facade/collection';
|
||||||
import {ObservableWrapper, EventEmitter} from 'angular2/src/facade/async';
|
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 {forwardRef, Binding} from 'angular2/di';
|
||||||
import {NgControl} from './ng_control';
|
import {NgControl} from './ng_control';
|
||||||
import {NgControlGroup} from './ng_control_group';
|
import {NgControlGroup} from './ng_control_group';
|
||||||
|
@ -84,7 +84,7 @@ const formDirectiveBinding =
|
||||||
selector: '[ng-form-model]',
|
selector: '[ng-form-model]',
|
||||||
hostInjector: [formDirectiveBinding],
|
hostInjector: [formDirectiveBinding],
|
||||||
properties: ['form: ng-form-model'],
|
properties: ['form: ng-form-model'],
|
||||||
lifecycle: [onChange],
|
lifecycle: [LifecycleEvent.onChange],
|
||||||
host: {
|
host: {
|
||||||
'(submit)': 'onSubmit()',
|
'(submit)': 'onSubmit()',
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,8 +2,7 @@ import {CONST_EXPR} from 'angular2/src/facade/lang';
|
||||||
import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async';
|
import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async';
|
||||||
import {StringMapWrapper} from 'angular2/src/facade/collection';
|
import {StringMapWrapper} from 'angular2/src/facade/collection';
|
||||||
|
|
||||||
import {Directive, Query, onChange} from 'angular2/annotations';
|
import {Directive, LifecycleEvent, QueryList, Query} from 'angular2/angular2';
|
||||||
import {QueryList} from 'angular2/core';
|
|
||||||
import {forwardRef, Ancestor, Binding} from 'angular2/di';
|
import {forwardRef, Ancestor, Binding} from 'angular2/di';
|
||||||
|
|
||||||
import {NgControl} from './ng_control';
|
import {NgControl} from './ng_control';
|
||||||
|
@ -34,7 +33,7 @@ const formControlBinding = CONST_EXPR(new Binding(NgControl, {toAlias: forwardRe
|
||||||
hostInjector: [formControlBinding],
|
hostInjector: [formControlBinding],
|
||||||
properties: ['model: ngModel'],
|
properties: ['model: ngModel'],
|
||||||
events: ['update: ngModel'],
|
events: ['update: ngModel'],
|
||||||
lifecycle: [onChange],
|
lifecycle: [LifecycleEvent.onChange],
|
||||||
exportAs: 'form'
|
exportAs: 'form'
|
||||||
})
|
})
|
||||||
export class NgModel extends NgControl {
|
export class NgModel extends NgControl {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import {Renderer} from 'angular2/render';
|
import {Renderer} from 'angular2/render';
|
||||||
import {ElementRef, QueryList} from 'angular2/core';
|
import {ElementRef, QueryList, Directive, Query} from 'angular2/angular2';
|
||||||
import {Directive, Query, onDestroy, onChange} from 'angular2/annotations';
|
|
||||||
|
|
||||||
import {NgControl} from './ng_control';
|
import {NgControl} from './ng_control';
|
||||||
import {ControlValueAccessor} from './control_value_accessor';
|
import {ControlValueAccessor} from './control_value_accessor';
|
||||||
|
|
|
@ -261,7 +261,7 @@ class _DirectiveMetadataVisitor extends Object
|
||||||
'$lifecycleValue');
|
'$lifecycleValue');
|
||||||
}
|
}
|
||||||
ListLiteral l = 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");
|
_callOnDestroy = lifecycleEvents.contains("onDestroy");
|
||||||
_callOnChange = lifecycleEvents.contains("onChange");
|
_callOnChange = lifecycleEvents.contains("onChange");
|
||||||
_callOnCheck = lifecycleEvents.contains("onCheck");
|
_callOnCheck = lifecycleEvents.contains("onCheck");
|
||||||
|
|
|
@ -19,7 +19,7 @@ main() {
|
||||||
|
|
||||||
it("should be true when the lifecycle includes onChange", () {
|
it("should be true when the lifecycle includes onChange", () {
|
||||||
expect(metadata(DirectiveNoHooks,
|
expect(metadata(DirectiveNoHooks,
|
||||||
new Directive(lifecycle: [onChange])).callOnChange).toBe(true);
|
new Directive(lifecycle: [LifecycleEvent.onChange])).callOnChange).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be false otherwise", () {
|
it("should be false otherwise", () {
|
||||||
|
@ -41,7 +41,7 @@ main() {
|
||||||
|
|
||||||
it("should be true when the lifecycle includes onDestroy", () {
|
it("should be true when the lifecycle includes onDestroy", () {
|
||||||
expect(metadata(DirectiveNoHooks,
|
expect(metadata(DirectiveNoHooks,
|
||||||
new Directive(lifecycle: [onDestroy])).callOnDestroy).toBe(true);
|
new Directive(lifecycle: [LifecycleEvent.onDestroy])).callOnDestroy).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be false otherwise", () {
|
it("should be false otherwise", () {
|
||||||
|
@ -59,7 +59,7 @@ main() {
|
||||||
|
|
||||||
it("should be true when the lifecycle includes onCheck", () {
|
it("should be true when the lifecycle includes onCheck", () {
|
||||||
expect(metadata(DirectiveNoHooks,
|
expect(metadata(DirectiveNoHooks,
|
||||||
new Directive(lifecycle: [onCheck])).callOnCheck).toBe(true);
|
new Directive(lifecycle: [LifecycleEvent.onCheck])).callOnCheck).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be false otherwise", () {
|
it("should be false otherwise", () {
|
||||||
|
@ -77,7 +77,7 @@ main() {
|
||||||
|
|
||||||
it("should be true when the lifecycle includes onInit", () {
|
it("should be true when the lifecycle includes onInit", () {
|
||||||
expect(metadata(DirectiveNoHooks,
|
expect(metadata(DirectiveNoHooks,
|
||||||
new Directive(lifecycle: [onInit])).callOnInit).toBe(true);
|
new Directive(lifecycle: [LifecycleEvent.onInit])).callOnInit).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be false otherwise", () {
|
it("should be false otherwise", () {
|
||||||
|
@ -94,7 +94,7 @@ main() {
|
||||||
|
|
||||||
it("should be true when the lifecycle includes onAllChangesDone", () {
|
it("should be true when the lifecycle includes onAllChangesDone", () {
|
||||||
expect(metadata(DirectiveNoHooks, new Directive(
|
expect(metadata(DirectiveNoHooks, new Directive(
|
||||||
lifecycle: [onAllChangesDone])).callOnAllChangesDone).toBe(true);
|
lifecycle: [LifecycleEvent.onAllChangesDone])).callOnAllChangesDone).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be false otherwise", () {
|
it("should be false otherwise", () {
|
||||||
|
|
|
@ -14,14 +14,7 @@ import {
|
||||||
proxy
|
proxy
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
|
|
||||||
import {
|
import {Directive, LifecycleEvent} from 'angular2/src/core/annotations_impl/annotations';
|
||||||
Directive,
|
|
||||||
onChange,
|
|
||||||
onDestroy,
|
|
||||||
onCheck,
|
|
||||||
onInit,
|
|
||||||
onAllChangesDone
|
|
||||||
} from 'angular2/src/core/annotations_impl/annotations';
|
|
||||||
import {DirectiveBinding} from 'angular2/src/core/compiler/element_injector';
|
import {DirectiveBinding} from 'angular2/src/core/compiler/element_injector';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
|
@ -37,7 +30,8 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be true when the lifecycle includes onChange", () => {
|
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);
|
.toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -57,7 +51,8 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be true when the lifecycle includes onDestroy", () => {
|
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);
|
.toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -72,7 +67,8 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be true when the lifecycle includes onDestroy", () => {
|
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);
|
.toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -86,7 +82,8 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be true when the lifecycle includes onCheck", () => {
|
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);
|
.toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -102,7 +99,8 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be true when the lifecycle includes onAllChangesDone", () => {
|
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)
|
.callOnAllChangesDone)
|
||||||
.toBe(true);
|
.toBe(true);
|
||||||
});
|
});
|
||||||
|
|
|
@ -21,7 +21,7 @@ import {
|
||||||
|
|
||||||
import {Injector} from 'angular2/di';
|
import {Injector} from 'angular2/di';
|
||||||
import {NgIf} from 'angular2/directives';
|
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 * as viewAnn from 'angular2/src/core/annotations_impl/view';
|
||||||
import {DynamicComponentLoader} from 'angular2/src/core/compiler/dynamic_component_loader';
|
import {DynamicComponentLoader} from 'angular2/src/core/compiler/dynamic_component_loader';
|
||||||
import {ElementRef} from 'angular2/src/core/compiler/element_ref';
|
import {ElementRef} from 'angular2/src/core/compiler/element_ref';
|
||||||
|
@ -267,7 +267,7 @@ class DynamicallyCreatedComponentService {}
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'hello-cmp',
|
selector: 'hello-cmp',
|
||||||
viewInjector: [DynamicallyCreatedComponentService],
|
viewInjector: [DynamicallyCreatedComponentService],
|
||||||
lifecycle: [onDestroy]
|
lifecycle: [LifecycleEvent.onDestroy]
|
||||||
})
|
})
|
||||||
@View({template: "{{greeting}}"})
|
@View({template: "{{greeting}}"})
|
||||||
class DynamicallyCreatedCmp {
|
class DynamicallyCreatedCmp {
|
||||||
|
|
|
@ -38,7 +38,7 @@ import {
|
||||||
Query,
|
Query,
|
||||||
Component,
|
Component,
|
||||||
Directive,
|
Directive,
|
||||||
onDestroy
|
LifecycleEvent
|
||||||
} from 'angular2/annotations';
|
} from 'angular2/annotations';
|
||||||
import {bind, Injector, Binding, Optional, Inject, Injectable, Self, Parent, Ancestor, Unbounded, InjectMetadata, ParentMetadata} from 'angular2/di';
|
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';
|
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", () => {
|
it("should call onDestroy on directives subscribed to this event", () => {
|
||||||
var inj = injector(ListWrapper.concat(
|
var inj = injector(ListWrapper.concat(
|
||||||
[DirectiveBinding.createFromType(DirectiveWithDestroy,
|
[DirectiveBinding.createFromType(DirectiveWithDestroy,
|
||||||
new dirAnn.Directive({lifecycle: [onDestroy]}))],
|
new dirAnn.Directive({lifecycle: [LifecycleEvent.onDestroy]}))],
|
||||||
extraBindings));
|
extraBindings));
|
||||||
var destroy = inj.get(DirectiveWithDestroy);
|
var destroy = inj.get(DirectiveWithDestroy);
|
||||||
inj.dehydrate();
|
inj.dehydrate();
|
||||||
|
|
|
@ -195,7 +195,7 @@ class NoPropertyAccess {
|
||||||
|
|
||||||
@Component(selector: 'on-change',
|
@Component(selector: 'on-change',
|
||||||
// TODO: needed because of https://github.com/angular/angular/issues/2120
|
// 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: '')
|
@View(template: '')
|
||||||
class OnChangeComponent implements OnChange {
|
class OnChangeComponent implements OnChange {
|
||||||
Map changes;
|
Map changes;
|
||||||
|
|
|
@ -14,15 +14,7 @@ import {
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
|
|
||||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||||
import {
|
import {Directive, Component, View, LifecycleEvent} from 'angular2/angular2';
|
||||||
Directive,
|
|
||||||
Component,
|
|
||||||
View,
|
|
||||||
onCheck,
|
|
||||||
onInit,
|
|
||||||
onChange,
|
|
||||||
onAllChangesDone
|
|
||||||
} from 'angular2/angular2';
|
|
||||||
import * as viewAnn from 'angular2/src/core/annotations_impl/view';
|
import * as viewAnn from 'angular2/src/core/annotations_impl/view';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
|
@ -62,7 +54,12 @@ export function main() {
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: "[lifecycle]",
|
selector: "[lifecycle]",
|
||||||
properties: ['field'],
|
properties: ['field'],
|
||||||
lifecycle: [onChange, onCheck, onInit, onAllChangesDone]
|
lifecycle: [
|
||||||
|
LifecycleEvent.onChange,
|
||||||
|
LifecycleEvent.onCheck,
|
||||||
|
LifecycleEvent.onInit,
|
||||||
|
LifecycleEvent.onAllChangesDone
|
||||||
|
]
|
||||||
})
|
})
|
||||||
class LifecycleDir {
|
class LifecycleDir {
|
||||||
field;
|
field;
|
||||||
|
|
|
@ -8,11 +8,7 @@ import 'package:angular2/angular2.dart'
|
||||||
Directive,
|
Directive,
|
||||||
View,
|
View,
|
||||||
NgElement,
|
NgElement,
|
||||||
onChange,
|
LifecycleEvent;
|
||||||
onDestroy,
|
|
||||||
onInit,
|
|
||||||
onCheck,
|
|
||||||
onAllChangesDone;
|
|
||||||
|
|
||||||
var _visited = false;
|
var _visited = false;
|
||||||
void initReflector(reflector) {
|
void initReflector(reflector) {
|
||||||
|
|
|
@ -8,11 +8,7 @@ import 'package:angular2/angular2.dart'
|
||||||
Directive,
|
Directive,
|
||||||
View,
|
View,
|
||||||
NgElement,
|
NgElement,
|
||||||
onChange,
|
LifecycleEvent;
|
||||||
onDestroy,
|
|
||||||
onInit,
|
|
||||||
onCheck,
|
|
||||||
onAllChangesDone;
|
|
||||||
|
|
||||||
var _visited = false;
|
var _visited = false;
|
||||||
void initReflector(reflector) {
|
void initReflector(reflector) {
|
||||||
|
|
|
@ -8,11 +8,7 @@ import 'package:angular2/angular2.dart'
|
||||||
Directive,
|
Directive,
|
||||||
View,
|
View,
|
||||||
NgElement,
|
NgElement,
|
||||||
onChange,
|
LifecycleEvent;
|
||||||
onDestroy,
|
|
||||||
onInit,
|
|
||||||
onCheck,
|
|
||||||
onAllChangesDone;
|
|
||||||
|
|
||||||
var _visited = false;
|
var _visited = false;
|
||||||
void initReflector(reflector) {
|
void initReflector(reflector) {
|
||||||
|
|
|
@ -8,11 +8,7 @@ import 'package:angular2/angular2.dart'
|
||||||
Directive,
|
Directive,
|
||||||
View,
|
View,
|
||||||
NgElement,
|
NgElement,
|
||||||
onChange,
|
LifecycleEvent;
|
||||||
onDestroy,
|
|
||||||
onInit,
|
|
||||||
onCheck,
|
|
||||||
onAllChangesDone;
|
|
||||||
|
|
||||||
var _visited = false;
|
var _visited = false;
|
||||||
void initReflector(reflector) {
|
void initReflector(reflector) {
|
||||||
|
@ -24,7 +20,8 @@ void initReflector(reflector) {
|
||||||
'parameters': const [const []],
|
'parameters': const [const []],
|
||||||
'annotations': const [
|
'annotations': const [
|
||||||
const Component(
|
const Component(
|
||||||
lifecycle: [onChange, onDestroy, onInit, onCheck, onAllChangesDone])
|
lifecycle: [LifecycleEvent.onChange, LifecycleEvent.onDestroy, LifecycleEvent.onInit,
|
||||||
|
LifecycleEvent.onCheck, LifecycleEvent.onAllChangesDone])
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -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';
|
import {isPresent} from 'angular2/src/facade/lang';
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ export class MdButton {
|
||||||
selector: '[md-button][href]',
|
selector: '[md-button][href]',
|
||||||
properties: ['disabled'],
|
properties: ['disabled'],
|
||||||
host: {'(click)': 'onClick($event)', '[tabIndex]': 'tabIndex'},
|
host: {'(click)': 'onClick($event)', '[tabIndex]': 'tabIndex'},
|
||||||
lifecycle: [onChange]
|
lifecycle: [LifecycleEvent.onChange]
|
||||||
})
|
})
|
||||||
@View({templateUrl: 'angular2_material/src/components/button/button.html'})
|
@View({templateUrl: 'angular2_material/src/components/button/button.html'})
|
||||||
export class MdAnchor {
|
export class MdAnchor {
|
||||||
|
|
|
@ -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 {ListWrapper} from 'angular2/src/facade/collection';
|
||||||
import {StringWrapper, isPresent, isString, NumberWrapper} from 'angular2/src/facade/lang';
|
import {StringWrapper, isPresent, isString, NumberWrapper} from 'angular2/src/facade/lang';
|
||||||
|
@ -14,7 +14,7 @@ import {Math} from 'angular2/src/facade/math';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'md-grid-list',
|
selector: 'md-grid-list',
|
||||||
properties: ['cols', 'rowHeight', 'gutterSize'],
|
properties: ['cols', 'rowHeight', 'gutterSize'],
|
||||||
lifecycle: [onAllChangesDone]
|
lifecycle: [LifecycleEvent.onAllChangesDone]
|
||||||
})
|
})
|
||||||
@View({templateUrl: 'angular2_material/src/components/grid_list/grid_list.html'})
|
@View({templateUrl: 'angular2_material/src/components/grid_list/grid_list.html'})
|
||||||
export class MdGridList {
|
export class MdGridList {
|
||||||
|
@ -221,7 +221,7 @@ export class MdGridList {
|
||||||
'[style.paddingTop]': 'stylePaddingTop',
|
'[style.paddingTop]': 'stylePaddingTop',
|
||||||
'[attr.role]': '"listitem"'
|
'[attr.role]': '"listitem"'
|
||||||
},
|
},
|
||||||
lifecycle: [onDestroy, onChange]
|
lifecycle: [LifecycleEvent.onDestroy, LifecycleEvent.onChange]
|
||||||
})
|
})
|
||||||
@View({templateUrl: 'angular2_material/src/components/grid_list/grid_tile.html'})
|
@View({templateUrl: 'angular2_material/src/components/grid_list/grid_tile.html'})
|
||||||
export class MdGridTile {
|
export class MdGridTile {
|
||||||
|
|
|
@ -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';
|
import {ObservableWrapper, EventEmitter} from 'angular2/src/facade/async';
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import {ObservableWrapper, EventEmitter} from 'angular2/src/facade/async';
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: 'md-input-container',
|
selector: 'md-input-container',
|
||||||
lifecycle: [onAllChangesDone],
|
lifecycle: [LifecycleEvent.onAllChangesDone],
|
||||||
host:
|
host:
|
||||||
{'[class.md-input-has-value]': 'inputHasValue', '[class.md-input-focused]': 'inputHasFocus'}
|
{'[class.md-input-has-value]': 'inputHasValue', '[class.md-input-focused]': 'inputHasFocus'}
|
||||||
})
|
})
|
||||||
|
|
|
@ -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 {isPresent, isBlank} from 'angular2/src/facade/lang';
|
||||||
import {Math} from 'angular2/src/facade/math';
|
import {Math} from 'angular2/src/facade/math';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'md-progress-linear',
|
selector: 'md-progress-linear',
|
||||||
lifecycle: [onChange],
|
lifecycle: [LifecycleEvent.onChange],
|
||||||
properties: ['value', 'bufferValue'],
|
properties: ['value', 'bufferValue'],
|
||||||
host: {
|
host: {
|
||||||
'[attr.role]': '"progressbar"',
|
'[attr.role]': '"progressbar"',
|
||||||
|
|
|
@ -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 {isPresent, StringWrapper, NumberWrapper} from 'angular2/src/facade/lang';
|
||||||
import {ObservableWrapper, EventEmitter} from 'angular2/src/facade/async';
|
import {ObservableWrapper, EventEmitter} from 'angular2/src/facade/async';
|
||||||
|
@ -24,7 +32,7 @@ var _uniqueIdCounter: number = 0;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'md-radio-group',
|
selector: 'md-radio-group',
|
||||||
lifecycle: [onChange],
|
lifecycle: [LifecycleEvent.onChange],
|
||||||
events: ['change'],
|
events: ['change'],
|
||||||
properties: ['disabled', 'value'],
|
properties: ['disabled', 'value'],
|
||||||
host: {
|
host: {
|
||||||
|
@ -179,7 +187,7 @@ export class MdRadioGroup {
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'md-radio-button',
|
selector: 'md-radio-button',
|
||||||
lifecycle: [onChange],
|
lifecycle: [LifecycleEvent.onChange],
|
||||||
properties: ['id', 'name', 'value', 'checked', 'disabled'],
|
properties: ['id', 'name', 'value', 'checked', 'disabled'],
|
||||||
host: {
|
host: {
|
||||||
'(keydown)': 'onKeydown($event)',
|
'(keydown)': 'onKeydown($event)',
|
||||||
|
|
Loading…
Reference in New Issue