mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
use injector instead of passing params
This commit is contained in:
@ -25,12 +25,9 @@ export class Nav extends ViewController {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Optional() viewCtrl: ViewController,
|
@Optional() viewCtrl: ViewController,
|
||||||
compiler: Compiler,
|
|
||||||
elementRef: ElementRef,
|
|
||||||
loader: DynamicComponentLoader,
|
|
||||||
injector: Injector
|
injector: Injector
|
||||||
) {
|
) {
|
||||||
super(viewCtrl, compiler, elementRef, loader, injector);
|
super(viewCtrl, injector);
|
||||||
}
|
}
|
||||||
|
|
||||||
onInit() {
|
onInit() {
|
||||||
|
@ -36,15 +36,13 @@ export class Tab extends ViewController {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Parent() tabs: Tabs,
|
@Parent() tabs: Tabs,
|
||||||
compiler: Compiler,
|
|
||||||
elementRef: ElementRef,
|
elementRef: ElementRef,
|
||||||
loader: DynamicComponentLoader,
|
|
||||||
injector: Injector
|
injector: Injector
|
||||||
) {
|
) {
|
||||||
// A Tab is both a container of many views, and is a view itself.
|
// A Tab is both a container of many views, and is a view itself.
|
||||||
// A Tab is one ViewItem within it's parent Tabs (which extends ViewController)
|
// A Tab is one ViewItem within it's parent Tabs (which extends ViewController)
|
||||||
// A Tab is a ViewController for its child ViewItems
|
// A Tab is a ViewController for its child ViewItems
|
||||||
super(tabs, compiler, elementRef, loader, injector);
|
super(tabs, injector);
|
||||||
this.tabs = tabs;
|
this.tabs = tabs;
|
||||||
|
|
||||||
this.childNavbar(true);
|
this.childNavbar(true);
|
||||||
|
@ -46,12 +46,9 @@ export class Tabs extends ViewController {
|
|||||||
constructor(
|
constructor(
|
||||||
@Optional() parentViewCtrl: ViewController,
|
@Optional() parentViewCtrl: ViewController,
|
||||||
@Optional() viewItem: ViewItem,
|
@Optional() viewItem: ViewItem,
|
||||||
compiler: Compiler,
|
|
||||||
elementRef: ElementRef,
|
|
||||||
loader: DynamicComponentLoader,
|
|
||||||
injector: Injector
|
injector: Injector
|
||||||
) {
|
) {
|
||||||
super(parentViewCtrl, compiler, elementRef, loader, injector);
|
super(parentViewCtrl, injector);
|
||||||
|
|
||||||
// Tabs may also be an actual ViewItem which was navigated to
|
// Tabs may also be an actual ViewItem which was navigated to
|
||||||
// if Tabs is static and not navigated to within a ViewController
|
// if Tabs is static and not navigated to within a ViewController
|
||||||
|
@ -15,20 +15,14 @@ export class ViewController {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
parentViewCtrl: ViewController,
|
parentViewCtrl: ViewController,
|
||||||
compiler: Compiler,
|
|
||||||
elementRef: ElementRef,
|
|
||||||
loader: DynamicComponentLoader,
|
|
||||||
injector: Injector
|
injector: Injector
|
||||||
) {
|
) {
|
||||||
|
|
||||||
this.parent = parentViewCtrl;
|
this.parent = parentViewCtrl;
|
||||||
this.compiler = compiler;
|
|
||||||
this.elementRef = elementRef;
|
|
||||||
this.loader = loader;
|
|
||||||
this.injector = injector;
|
|
||||||
|
|
||||||
// TODO: Make this generic?
|
this.compiler = injector.get(Compiler);
|
||||||
this.ele = elementRef.nativeElement;
|
this.loader = injector.get(DynamicComponentLoader);
|
||||||
|
this.injector = injector;
|
||||||
|
|
||||||
this.items = [];
|
this.items = [];
|
||||||
this.navCtrl = new NavController(this);
|
this.navCtrl = new NavController(this);
|
||||||
|
Reference in New Issue
Block a user