feat(di): removed app injector
BREAKING CHANGE: THe appInjector property has been removed. Instead use viewInjector or hostInjector.
This commit is contained in:
@ -29,7 +29,7 @@ class RedDec {
|
||||
selector: 'hello-app',
|
||||
// These are services that would be created if a class in the component's
|
||||
// template tries to inject them.
|
||||
appInjector: [GreetingService]
|
||||
viewInjector: [GreetingService]
|
||||
})
|
||||
// The template for the component.
|
||||
@View({
|
||||
|
@ -6,13 +6,13 @@ import {
|
||||
} from 'angular2_material/src/components/dialog/dialog';
|
||||
import {UrlResolver} from 'angular2/src/services/url_resolver';
|
||||
import {commonDemoSetup, DemoUrlResolver} from '../demo_common';
|
||||
import {bind, Injector} from 'angular2/di';
|
||||
import {bind} from 'angular2/di';
|
||||
import {isPresent} from 'angular2/src/facade/lang';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'demo-app',
|
||||
appInjector: [MdDialog],
|
||||
viewInjector: [MdDialog],
|
||||
})
|
||||
@View({
|
||||
templateUrl: './demo_app.html',
|
||||
@ -23,14 +23,12 @@ class DemoApp {
|
||||
elementRef: ElementRef;
|
||||
dialogRef: MdDialogRef;
|
||||
dialogConfig: MdDialogConfig;
|
||||
injector: Injector;
|
||||
lastResult: string;
|
||||
|
||||
constructor(mdDialog: MdDialog, elementRef: ElementRef, injector: Injector) {
|
||||
constructor(mdDialog: MdDialog, elementRef: ElementRef) {
|
||||
this.dialog = mdDialog;
|
||||
this.elementRef = elementRef;
|
||||
this.dialogConfig = new MdDialogConfig();
|
||||
this.injector = injector;
|
||||
|
||||
this.dialogConfig.width = '60%';
|
||||
this.dialogConfig.height = '60%';
|
||||
@ -42,7 +40,7 @@ class DemoApp {
|
||||
return;
|
||||
}
|
||||
|
||||
this.dialog.open(SimpleDialogComponent, this.elementRef, this.injector, this.dialogConfig)
|
||||
this.dialog.open(SimpleDialogComponent, this.elementRef, this.dialogConfig)
|
||||
.then(ref => {
|
||||
this.dialogRef = ref;
|
||||
ref.instance.numCoconuts = 777;
|
||||
|
@ -5,7 +5,7 @@ import {UrlResolver} from 'angular2/src/services/url_resolver';
|
||||
import {commonDemoSetup, DemoUrlResolver} from '../demo_common';
|
||||
import {bind} from 'angular2/di';
|
||||
|
||||
@Component({selector: 'demo-app', appInjector: [MdRadioDispatcher]})
|
||||
@Component({selector: 'demo-app', viewInjector: [MdRadioDispatcher]})
|
||||
@View({templateUrl: './demo_app.html', directives: [MdRadioGroup, MdRadioButton]})
|
||||
class DemoApp {
|
||||
thirdValue;
|
||||
|
@ -72,7 +72,7 @@ class ShowError {
|
||||
}
|
||||
|
||||
|
||||
@Component({selector: 'model-driven-forms', appInjector: [FormBuilder]})
|
||||
@Component({selector: 'model-driven-forms', viewInjector: [FormBuilder]})
|
||||
@View({
|
||||
template: `
|
||||
<h1>Checkout Form (Model Driven)</h1>
|
||||
|
@ -3,7 +3,7 @@ import {Store, Todo, TodoFactory} from './services/TodoStore';
|
||||
import {reflector} from 'angular2/src/reflection/reflection';
|
||||
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
|
||||
|
||||
@Component({selector: 'todo-app', appInjector: [Store, TodoFactory]})
|
||||
@Component({selector: 'todo-app', viewInjector: [Store, TodoFactory]})
|
||||
@View({templateUrl: 'todo.html', directives: [NgFor]})
|
||||
class TodoApp {
|
||||
todoEdit: Todo = null;
|
||||
|
Reference in New Issue
Block a user