我试着将AngularJs与ui.router一起使用,但遇到了麻烦.
此示例有三种状态:index,template和template.show
$stateProvider
.state('/', {
url: '',
template: '<a ui-sref="template">GoTo Template Index</a>'
})
.state('template', {
url: 'template',
templateUrl: 'template_index.html',
controller: 'TemplateCtrl'
})
.state('template.show', {
url: '/{templateId:[0-9]+}',
templateUrl: 'template_show.html',
controller: 'TemplateShowCtrl'
})
Run Code Online (Sandbox Code Playgroud)
请参阅plunker:http://plnkr.co/edit/prluQs9vXeJw9IVi2JYW?p = info
但只有两个第一州工作.状态"template.show"更改,加载模板,但不执行 TemplateShowCtrl并且不将 ui-view 更新为新模板.
你可以看到截图