diff --git a/ionic/components/button/button.ts b/ionic/components/button/button.ts index 9d9dc89485..f413d719be 100644 --- a/ionic/components/button/button.ts +++ b/ionic/components/button/button.ts @@ -1,4 +1,4 @@ -import {Directive, ElementRef, Optional, Ancestor, onDestroy, NgZone, Query, QueryList} from 'angular2/angular2'; +import {Directive, ElementRef, Optional, Host, onDestroy, NgZone, Query, QueryList} from 'angular2/angular2'; import {Icon} from '../icon/icon'; import {IonicConfig} from '../../config/config'; @@ -50,7 +50,7 @@ export class TapClick { elementRef: ElementRef, config: IonicConfig, ngZone: NgZone, - @Optional() @Ancestor() tapDisabled: TapDisabled + @Optional() @Host() tapDisabled: TapDisabled ) { this.ele = elementRef.nativeElement; this.tapEnabled = !tapDisabled; diff --git a/ionic/components/form/focus-holder.ts b/ionic/components/form/focus-holder.ts index b365c6a740..3fee5f63de 100644 --- a/ionic/components/form/focus-holder.ts +++ b/ionic/components/form/focus-holder.ts @@ -1,4 +1,4 @@ -import {Component, Directive, View, Ancestor, ElementRef, forwardRef} from 'angular2/angular2'; +import {Component, Directive, View, Host, ElementRef, forwardRef} from 'angular2/angular2'; import {IonicConfig} from '../../config/config'; import * as dom from '../../util/dom'; @@ -75,7 +75,7 @@ export class FocusHolder { } }) class FocusInput { - constructor(elementRef: ElementRef, @Ancestor() holder: FocusHolder) { + constructor(elementRef: ElementRef, @Host() holder: FocusHolder) { this.elementRef = elementRef; holder.register(this); this.holder = holder; diff --git a/ionic/components/form/label.ts b/ionic/components/form/label.ts index 0a5623c313..a23653d7ee 100644 --- a/ionic/components/form/label.ts +++ b/ionic/components/form/label.ts @@ -1,4 +1,4 @@ -import {Directive, Ancestor, Optional} from 'angular2/angular2'; +import {Directive, Host, Optional} from 'angular2/angular2'; import {IonicConfig} from '../../config/config'; import * as dom from '../../util/dom'; @@ -21,10 +21,10 @@ import {Switch} from '../switch/switch'; }) export class Label { constructor( - @Optional() @Ancestor() textContainer: Input, - @Optional() @Ancestor() checkboxContainer: Checkbox, - @Optional() @Ancestor() radioContainer: RadioButton, - @Optional() @Ancestor() switchContainer: Switch, + @Optional() @Host() textContainer: Input, + @Optional() @Host() checkboxContainer: Checkbox, + @Optional() @Host() radioContainer: RadioButton, + @Optional() @Host() switchContainer: Switch, config: IonicConfig ) { this.container = textContainer || checkboxContainer || radioContainer || switchContainer; diff --git a/ionic/components/form/tap-input.ts b/ionic/components/form/tap-input.ts index 1f84251e60..229f370101 100644 --- a/ionic/components/form/tap-input.ts +++ b/ionic/components/form/tap-input.ts @@ -1,4 +1,4 @@ -import {Ancestor, Optional, ElementRef, Attribute, Directive} from 'angular2/angular2'; +import {Host, Optional, ElementRef, Attribute, Directive} from 'angular2/angular2'; import {IonInput} from './input'; import {IonicApp} from '../app/app'; @@ -24,9 +24,9 @@ import {RadioButton} from '../radio/radio'; }) export class TapInput extends IonInput { constructor( - @Optional() @Ancestor() checkboxContainer: Checkbox, - @Optional() @Ancestor() radioContainer: RadioButton, - @Optional() @Ancestor() scrollView: Content, + @Optional() @Host() checkboxContainer: Checkbox, + @Optional() @Host() radioContainer: RadioButton, + @Optional() @Host() scrollView: Content, @Attribute('type') type: string, elementRef: ElementRef, app: IonicApp, diff --git a/ionic/components/form/text-input.ts b/ionic/components/form/text-input.ts index 571e227a52..8afd0b7475 100644 --- a/ionic/components/form/text-input.ts +++ b/ionic/components/form/text-input.ts @@ -1,4 +1,4 @@ -import {Directive, View, Ancestor, Optional, ElementRef, Attribute, forwardRef} from 'angular2/angular2'; +import {Directive, View, Host, Optional, ElementRef, Attribute, forwardRef} from 'angular2/angular2'; import {IonicDirective} from '../../config/annotations'; import {IonicConfig} from '../../config/config'; @@ -51,8 +51,8 @@ export class Input extends IonInputItem { }) export class TextInput extends IonInput { constructor( - @Optional() @Ancestor() container: Input, - @Optional() @Ancestor() scrollView: Content, + @Optional() @Host() container: Input, + @Optional() @Host() scrollView: Content, @Attribute('type') type: string, elementRef: ElementRef, app: IonicApp, diff --git a/ionic/components/icon/icon.ts b/ionic/components/icon/icon.ts index 4d9dc4637b..b6711237f5 100644 --- a/ionic/components/icon/icon.ts +++ b/ionic/components/icon/icon.ts @@ -1,4 +1,4 @@ -import {Directive, View, CSSClass, ElementRef, Optional, Ancestor, Attribute, Renderer} from 'angular2/angular2'; +import {Directive, View, CSSClass, ElementRef, Optional, Host, Attribute, Renderer} from 'angular2/angular2'; import {IonicConfig} from '../../config/config'; import {IonicComponent} from '../../config/annotations'; @@ -66,7 +66,7 @@ Custom Font Icon export class IconDirective { constructor( private _elementRef: ElementRef, - @Optional() @Ancestor() AncestorButton: Button, + @Optional() @Host() hostButton: Button, @Attribute('forward') forward: string, config: IonicConfig, private renderer: Renderer @@ -80,7 +80,7 @@ export class IconDirective { this.fwdIcon = config.setting('forwardIcon'); } - if (AncestorButton) { + if (hostButton) { // this icon is within a button this.withinButton = true; @@ -98,7 +98,7 @@ export class IconDirective { // tell the button there's a child icon // the button will set the correct css classes on itself - AncestorButton.registerIcon(this); + hostButton.registerIcon(this); } } diff --git a/ionic/components/item/item-swipe-buttons.ts b/ionic/components/item/item-swipe-buttons.ts index 7b6ebd14b6..ea28090319 100644 --- a/ionic/components/item/item-swipe-buttons.ts +++ b/ionic/components/item/item-swipe-buttons.ts @@ -1,4 +1,4 @@ -import {ElementRef, Ancestor, Directive} from 'angular2/angular2'; +import {ElementRef, Host, Directive} from 'angular2/angular2'; import {Item} from 'ionic/components/item/item'; import {SlideGesture} from 'ionic/gestures/slide-gesture'; @@ -10,21 +10,21 @@ import {SlideGesture} from 'ionic/gestures/slide-gesture'; export class ItemPrimarySwipeButtons { constructor( elementRef: ElementRef, - @Ancestor() item: Item + @Host() item: Item ) { - item.primarySwipeButtons = this - this.ele = elementRef.nativeElement - this.AncestorItem = item - this.gesture = new ItemSlideGesture(this) - this.gesture.listen() + item.primarySwipeButtons = this; + this.ele = elementRef.nativeElement; + this.item = item; + this.gesture = new ItemSlideGesture(this); + this.gesture.listen(); } setOpen(isOpen) { if (isOpen !== this.isOpen) { - this.isOpen = isOpen + this.isOpen = isOpen; requestAnimationFrame(() => { - this.ele.classList[isOpen?'add':'remove'](isOpen) - }) + this.ele.classList[isOpen?'add':'remove'](isOpen); + }); } } } @@ -37,7 +37,7 @@ export class ItemSecondarySwipeButtons { class ItemSlideGesture extends SlideGesture { constructor(buttons) { - super(buttons.AncestorItem.ele) + super(buttons.item.ele) this.buttons = buttons } diff --git a/ionic/components/list/test/infinite/index.ts b/ionic/components/list/test/infinite/index.ts index 223f29b4ad..57e5f124b5 100644 --- a/ionic/components/list/test/infinite/index.ts +++ b/ionic/components/list/test/infinite/index.ts @@ -1,5 +1,5 @@ import {ProtoViewRef, ViewContainerRef} from 'angular2/angular2' -import {Directive, Ancestor, forwardRef} from 'angular2/angular2'; +import {Directive, Host, forwardRef} from 'angular2/angular2'; import {App, List} from 'ionic/ionic'; @@ -31,7 +31,7 @@ class IonicApp { selector: 'template[cell]' }) export class ItemCellTemplate { - constructor(@Ancestor() list: List, viewContainer: ViewContainerRef, protoViewRef: ProtoViewRef) { + constructor(@Host() list: List, viewContainer: ViewContainerRef, protoViewRef: ProtoViewRef) { console.log('Item cell template', list, viewContainer, protoViewRef); this.protoViewRef = protoViewRef; diff --git a/ionic/components/nav-bar/nav-bar.ts b/ionic/components/nav-bar/nav-bar.ts index 580eca83f9..5c12189828 100644 --- a/ionic/components/nav-bar/nav-bar.ts +++ b/ionic/components/nav-bar/nav-bar.ts @@ -1,4 +1,4 @@ -import {Directive, View, Ancestor, Optional, ElementRef, forwardRef} from 'angular2/angular2'; +import {Directive, View, Host, Optional, ElementRef, forwardRef} from 'angular2/angular2'; import {ProtoViewRef} from 'angular2/src/core/compiler/view_ref'; import {TemplateRef} from 'angular2/angular2'; @@ -90,7 +90,7 @@ export class Navbar extends ToolbarBase { } }) class BackButton { - constructor(@Ancestor() navbar: Navbar, @Optional() item: ViewItem, elementRef: ElementRef) { + constructor(@Host() navbar: Navbar, @Optional() item: ViewItem, elementRef: ElementRef) { this.item = item; navbar.backButtonElement(elementRef); } @@ -106,7 +106,7 @@ class BackButton { selector: '.back-button-text' }) class BackButtonText { - constructor(@Ancestor() navbar: Navbar, elementRef: ElementRef) { + constructor(@Host() navbar: Navbar, elementRef: ElementRef) { navbar.backButtonTextElement(elementRef); } } @@ -115,7 +115,7 @@ class BackButtonText { selector: '.toolbar-title' }) class Title { - constructor(@Ancestor() toolbar: Navbar, elementRef: ElementRef) { + constructor(@Host() toolbar: Navbar, elementRef: ElementRef) { toolbar.titleElement(elementRef); } } @@ -124,7 +124,7 @@ class Title { selector: '.toolbar-item' }) class NavbarItem { - constructor(@Ancestor() toolbar: Navbar, elementRef: ElementRef) { + constructor(@Host() toolbar: Navbar, elementRef: ElementRef) { toolbar.itemElements(elementRef); } } diff --git a/ionic/components/nav/anchors.ts b/ionic/components/nav/anchors.ts index 94b18787c8..dc214497eb 100644 --- a/ionic/components/nav/anchors.ts +++ b/ionic/components/nav/anchors.ts @@ -1,4 +1,4 @@ -import {Component, View, Directive, Ancestor, ElementRef, forwardRef, Inject} from 'angular2/angular2'; +import {Component, View, Directive, Host, ElementRef, forwardRef, Inject} from 'angular2/angular2'; import {ViewContainerRef} from 'angular2/src/core/compiler/view_container_ref'; import {Pane} from './pane'; @@ -8,7 +8,7 @@ import {ViewController} from '../view/view-controller'; @Directive({selector: 'template[pane-anchor]'}) export class PaneAnchor { constructor( - @Ancestor() @Inject(forwardRef(() => Pane)) pane: Pane, + @Host() @Inject(forwardRef(() => Pane)) pane: Pane, elementRef: ElementRef ) { pane.sectionAnchorElementRef = elementRef; @@ -19,7 +19,7 @@ export class PaneAnchor { @Directive({selector: 'template[content-anchor]'}) export class PaneContentAnchor { constructor( - @Ancestor() @Inject(forwardRef(() => Pane)) pane: Pane, + @Host() @Inject(forwardRef(() => Pane)) pane: Pane, viewContainerRef: ViewContainerRef ) { pane.contentContainerRef = viewContainerRef; diff --git a/ionic/components/nav/nav.ts b/ionic/components/nav/nav.ts index f01bfd3a3a..bf13a6c18a 100644 --- a/ionic/components/nav/nav.ts +++ b/ionic/components/nav/nav.ts @@ -1,4 +1,4 @@ -import {Directive, View, ElementRef, Ancestor, Optional, forwardRef, Injector} from 'angular2/angular2'; +import {Directive, View, ElementRef, Host, Optional, forwardRef, Injector} from 'angular2/angular2'; import {IonicComponent} from '../../config/annotations'; import {ViewController} from '../view/view-controller'; @@ -20,11 +20,11 @@ import {ViewController} from '../view/view-controller'; export class Nav extends ViewController { constructor( - @Optional() ancestorViewCtrl: ViewController, + @Optional() hostViewCtrl: ViewController, injector: Injector, elementRef: ElementRef ) { - super(ancestorViewCtrl, injector, elementRef); + super(hostViewCtrl, injector, elementRef); } onIonInit() { @@ -43,7 +43,7 @@ export class Nav extends ViewController { @Directive({selector: 'template[pane-anchor]'}) class NavPaneAnchor { - constructor(@Ancestor() nav: Nav, elementRef: ElementRef) { + constructor(@Host() nav: Nav, elementRef: ElementRef) { nav.anchorElementRef(elementRef); } } diff --git a/ionic/components/nav/swipe-handle.ts b/ionic/components/nav/swipe-handle.ts index c6c97a3342..c495fcb6a0 100644 --- a/ionic/components/nav/swipe-handle.ts +++ b/ionic/components/nav/swipe-handle.ts @@ -1,4 +1,4 @@ -import {ElementRef, Directive, Ancestor, Optional, Inject, forwardRef, NgZone} from 'angular2/angular2'; +import {ElementRef, Directive, Host, Optional, Inject, forwardRef, NgZone} from 'angular2/angular2'; import {ViewController} from '../view/view-controller'; import {Pane} from './pane'; @@ -14,7 +14,7 @@ import {Gesture} from 'ionic/gestures/gesture'; export class SwipeHandle { constructor( @Optional() @Inject(forwardRef(() => ViewController)) viewCtrl: ViewController, - @Ancestor() @Inject(forwardRef(() => Pane)) pane: Pane, + @Host() @Inject(forwardRef(() => Pane)) pane: Pane, elementRef: ElementRef, ngZone: NgZone ) { diff --git a/ionic/components/nav/test/user-app/index.ts b/ionic/components/nav/test/user-app/index.ts index bd9b98069e..83a5c14469 100644 --- a/ionic/components/nav/test/user-app/index.ts +++ b/ionic/components/nav/test/user-app/index.ts @@ -5,7 +5,6 @@ import { bootstrap, Injectable, Inject, - Ancestor, forwardRef, Inject, DynamicComponentLoader, diff --git a/ionic/components/radio/radio.ts b/ionic/components/radio/radio.ts index c6765da759..5e5dc87977 100644 --- a/ionic/components/radio/radio.ts +++ b/ionic/components/radio/radio.ts @@ -1,4 +1,4 @@ -import {ElementRef, Ancestor, Optional, NgControl, Query, QueryList} from 'angular2/angular2'; +import {ElementRef, Host, Optional, NgControl, Query, QueryList} from 'angular2/angular2'; import {IonicDirective, IonicComponent, IonicView} from '../../config/annotations'; import {IonicConfig} from '../../config/config'; @@ -111,7 +111,7 @@ export class RadioGroup extends Ion { }) export class RadioButton extends IonInputItem { constructor( - @Ancestor() @Optional() group: RadioGroup, + @Host() @Optional() group: RadioGroup, elementRef: ElementRef, config: IonicConfig, tapClick: TapClick diff --git a/ionic/components/scroll/pull-to-refresh.ts b/ionic/components/scroll/pull-to-refresh.ts index ac14857a1f..5f98adacbb 100644 --- a/ionic/components/scroll/pull-to-refresh.ts +++ b/ionic/components/scroll/pull-to-refresh.ts @@ -1,4 +1,4 @@ -import {Component, View, NgIf, CSSClass, ElementRef, EventEmitter, Ancestor, onInit} from 'angular2/angular2' +import {Component, View, NgIf, CSSClass, ElementRef, EventEmitter, Host} from 'angular2/angular2' import {Content} from '../content/content'; @@ -20,8 +20,7 @@ import {raf, ready, CSS} from 'ionic/util/dom'; '[class.active]': 'isActive', '[class.refreshing]': 'isRefreshing', '[class.refreshingTail]': 'isRefreshingTail' - }, - lifecycle: [onInit] + } }) @View({ template: `