refactor(di): removed @Parent
BREAKING CHANGE The @Parent annotation has been removed. Use @Ancestor instead. @Parent was used to enforce a particular DOM structure (e.g., a pane component is a direct child of the tabs component). DI is not the right mechanism to do it. We should enforce it using schema instead.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import {Directive} from 'angular2/annotations';
|
||||
import {Parent} from 'angular2/di';
|
||||
import {Ancestor} from 'angular2/di';
|
||||
import {ViewContainerRef, TemplateRef} from 'angular2/core';
|
||||
import {isPresent, isBlank, normalizeBlank} from 'angular2/src/facade/lang';
|
||||
import {ListWrapper, List, MapWrapper, Map} from 'angular2/src/facade/collection';
|
||||
@ -157,7 +157,7 @@ export class NgSwitchWhen {
|
||||
_view: SwitchView;
|
||||
|
||||
constructor(viewContainer: ViewContainerRef, templateRef: TemplateRef,
|
||||
@Parent() sswitch: NgSwitch) {
|
||||
@Ancestor() sswitch: NgSwitch) {
|
||||
// `_whenDefault` is used as a marker for a not yet initialized value
|
||||
this._value = _whenDefault;
|
||||
this._switch = sswitch;
|
||||
@ -187,7 +187,7 @@ export class NgSwitchWhen {
|
||||
@Directive({selector: '[ng-switch-default]'})
|
||||
export class NgSwitchDefault {
|
||||
constructor(viewContainer: ViewContainerRef, templateRef: TemplateRef,
|
||||
@Parent() sswitch: NgSwitch) {
|
||||
@Ancestor() sswitch: NgSwitch) {
|
||||
sswitch._registerView(_whenDefault, new SwitchView(viewContainer, templateRef));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user