3
我想要子组件模板加载到父组件模板中。 (为缺乏更好的字眼我打电话给他们的孩子和父母)Angular2:通过指令不工作将外部组件注入其他组件
这是我的孩子:
import {Component,Directive, ElementRef, Input} from '@angular/core';
import {IONIC_DIRECTIVES} from 'ionic-angular';
@Component({
selector: '[parentselector]',
template: '<div>I AM A CHILD</div>',
directives: [IONIC_DIRECTIVES]
})
export class ChildPage {
constructor() {
}
}
这是我的父母:
@Component({
templateUrl: 'build/pages/parent/parent.html',
directives: [ChildPage]
})
和家长的HTML:
<ion-content>
<ion-slides>
<ion-slide><parentselector>Parent To Be Overriden</parentselector>
</ion-slide>
</ion-slides>
</ion-content>
任何想法最新怎么了?
非常好!谢啦! – nottinhill