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:
@ -2,7 +2,7 @@ import {
|
||||
Component,
|
||||
Directive,
|
||||
View,
|
||||
Parent,
|
||||
Ancestor,
|
||||
ElementRef,
|
||||
DynamicComponentLoader,
|
||||
ComponentRef,
|
||||
@ -243,7 +243,7 @@ class MdDialogContainer {
|
||||
*/
|
||||
@Directive({selector: 'md-dialog-content'})
|
||||
class MdDialogContent {
|
||||
constructor(@Parent() dialogContainer: MdDialogContainer, elementRef: ElementRef) {
|
||||
constructor(@Ancestor() dialogContainer: MdDialogContainer, elementRef: ElementRef) {
|
||||
dialogContainer.contentRef = elementRef;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Component, View, Parent, LifecycleEvent} from 'angular2/angular2';
|
||||
import {Component, View, Ancestor, LifecycleEvent} from 'angular2/angular2';
|
||||
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {StringWrapper, isPresent, isString, NumberWrapper} from 'angular2/src/facade/lang';
|
||||
@ -238,7 +238,7 @@ export class MdGridTile {
|
||||
|
||||
isRegisteredWithGridList: boolean;
|
||||
|
||||
constructor(@Parent() gridList: MdGridList) {
|
||||
constructor(@Ancestor() gridList: MdGridList) {
|
||||
this.gridList = gridList;
|
||||
|
||||
// Tiles default to 1x1, but rowspan and colspan can be changed via binding.
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Directive, LifecycleEvent, Attribute, Parent} from 'angular2/angular2';
|
||||
import {Directive, LifecycleEvent, Attribute, Ancestor} from 'angular2/angular2';
|
||||
|
||||
import {ObservableWrapper, EventEmitter} from 'angular2/src/facade/async';
|
||||
|
||||
@ -73,7 +73,7 @@ export class MdInput {
|
||||
mdChange: EventEmitter;
|
||||
mdFocusChange: EventEmitter;
|
||||
|
||||
constructor(@Attribute('value') value: string, @Parent() container: MdInputContainer,
|
||||
constructor(@Attribute('value') value: string, @Ancestor() container: MdInputContainer,
|
||||
@Attribute('id') id: string) {
|
||||
// TODO(jelbourn): Remove this when #1402 is done.
|
||||
this.yes = true;
|
||||
@ -111,7 +111,7 @@ export class MdInput {
|
||||
export class MdTextarea extends MdInput {
|
||||
constructor(
|
||||
@Attribute('value') value: string,
|
||||
@Parent() container: MdInputContainer,
|
||||
@Ancestor() container: MdInputContainer,
|
||||
@Attribute('id') id: string) {
|
||||
super(value, container, id);
|
||||
}
|
||||
|
@ -1,12 +1,4 @@
|
||||
import {
|
||||
Component,
|
||||
View,
|
||||
LifecycleEvent,
|
||||
Parent,
|
||||
Ancestor,
|
||||
Attribute,
|
||||
Optional
|
||||
} from 'angular2/angular2';
|
||||
import {Component, View, LifecycleEvent, Ancestor, Attribute, Optional} from 'angular2/angular2';
|
||||
|
||||
import {isPresent, StringWrapper, NumberWrapper} from 'angular2/src/facade/lang';
|
||||
import {ObservableWrapper, EventEmitter} from 'angular2/src/facade/async';
|
||||
@ -225,7 +217,7 @@ export class MdRadioButton {
|
||||
|
||||
role: string;
|
||||
|
||||
constructor(@Optional() @Parent() radioGroup: MdRadioGroup, @Attribute('id') id: string,
|
||||
constructor(@Optional() @Ancestor() radioGroup: MdRadioGroup, @Attribute('id') id: string,
|
||||
@Attribute('tabindex') tabindex: string, radioDispatcher: MdRadioDispatcher) {
|
||||
// Assertions. Ideally these should be stripped out by the compiler.
|
||||
// TODO(jelbourn): Assert that there's no name binding AND a parent radio group.
|
||||
|
Reference in New Issue
Block a user