mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
renderer.setElementClass for icon class
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user