我可以在 AngularJS 1.5 组件中使用多个模板吗?我有一个具有一个属性的组件,因此我想根据该属性名称加载不同的模板。如何实现基于元素属性名的模板加载?
jsConfigApp.component('show', {
templateUrl: 'component/show.html', //How to change it based on attribute value?
bindings:{
view:"@"
},
controller: function () {
console.log(this.view)
if (this.view = "user") {
console.log("user")
} else if (this.view = "user") {
console.log("shop")
} else {
console.log("none")
}
}
})
谢谢。