實例功能我有1組件調用「人」在HTML這樣其作品角1.5返回HTML結果在使用其他組件
<html>
<people data="$ctrl.data" isAlive="$ctrl.status"></people>
</html>
但是如果我想號召大家組件在另一個組件如何?
我嘗試這種解決方案,但它不工作
import templateUrl from './main.html';
export const mainComponent = {
bindings: {},
templateUrl,
controller: class MainComponent {
constructor() {
'ngInject';
}
$onInit() {
this.data = { name : test }
this.status = 'ALIVE'
this.people = `<people data="${this.data}"
isAlive="${this.status}">
</people>`
console.log(this.people) //this should return a html template with
// complete data
}
}
};
請告知
在你的榜樣,你使用''templateUrl ='」/main.html''。你想把「this.people」放在哪裏? –