renderer.setElementClass for icon class

This commit is contained in:
Adam Bradley
2015-08-01 00:24:29 -05:00
parent c0223edabe
commit 04fc983c2a
3 changed files with 9 additions and 23 deletions

View File

@@ -95,7 +95,9 @@ export class IonicApp {
let loader = this.injector.get(DynamicComponentLoader);
let rootComponentRef = this.ref()._hostComponent;
return loader.loadNextToLocation(component, rootComponentRef.location, this.bindings)
let bindings = this.injector._proto._strategy.bindings;
return loader.loadNextToLocation(component, rootComponentRef.location)
.catch(err => {
console.error('appendComponent:', err);
});
@@ -149,18 +151,6 @@ function initApp(window, document, config) {
return app;
}
@Component({
selector: 'test-comp'
})
@View({
template: 'test-comp text'
})
class TestComp {
constructor(config: IonicConfig) {
console.log('TestComp constructor')
}
}
export function ionicBootstrap(component, config, router) {
return new Promise(resolve => {
try {

View File

@@ -1,4 +1,4 @@
import {Directive, View, CSSClass, ElementRef, Optional, Ancestor, Attribute} from 'angular2/angular2';
import {Directive, View, CSSClass, ElementRef, Optional, Ancestor, Attribute, Renderer} from 'angular2/angular2';
import {IonicConfig} from '../../config/config';
import {IonicComponent} from '../../config/annotations';
@@ -65,12 +65,13 @@ Custom Font Icon
})
export class IconDirective {
constructor(
elementRef: ElementRef,
private _elementRef: ElementRef,
@Optional() @Ancestor() AncestorButton: Button,
@Attribute('forward') forward: string,
config: IonicConfig
config: IonicConfig,
private _renderer: Renderer
) {
let ele = this.ele = elementRef.nativeElement;
let ele = this.ele = _elementRef.nativeElement;
this.iconLeft = this.iconRight = this.iconOnly = false;
this.ariaHidden = true;
@@ -108,7 +109,7 @@ export class IconDirective {
if (!this.name) return;
// add the css class to show the icon font
this.ele.classList.add(this.name);
this._renderer.setElementClass(this._elementRef, this.name, true);
// hide the icon when it's within a button
// and the button isn't an icon only button

View File

@@ -46,11 +46,6 @@ export class ViewController extends Ion {
this._ids = -1;
// build a new injector for child ViewItems to use
this.injector = injector.resolveAndCreateChild([
bind(ViewController).toValue(this),
bind(NavController).toValue(new NavController(this))
]);
this.bindings = Injector.resolve([
bind(ViewController).toValue(this),
bind(NavController).toValue(new NavController(this))