Angularjs 动态更改组件模板
如果模板已在屏幕上呈现 如何更改组件(而不是ui路由器)中的模板 我知道我们可以改变Angularjs 动态更改组件模板,angularjs,Angularjs,如果模板已在屏幕上呈现 如何更改组件(而不是ui路由器)中的模板 我知道我们可以改变 $state.template = anotherlayout $state.reload() 但是否可以更改组件中的当前模板 import login from './login.html' .component('app', { template, controller }) function template () { return login } function co
$state.template = anotherlayout
$state.reload()
但是否可以更改组件中的当前模板
import login from './login.html'
.component('app', {
template,
controller
})
function template () {
return login
}
function controller ($scope) {
$scope.changeTemplate = function () {
// some code to change template in component
}
}
controller.$inject = ['$scope']
我已尝试更改$scope.$root.template,但没有任何结果