0
我有一个与在运行时设置控制器相关的查询。 我想是这样的:动态设置控制器角度
.state{'app.thisState',
url: '/thisUrl',
views:{
templateUrl: 'templates/some_template.html',
controller: 'XYZCtrlr' //This is where I want to set different controllers depending on the scenario.
}};
我们怎样才能在运行时设置控制器?
可以请你'精心VAR ctrlName = $ stateParams.type + “控制器” 选项
controllerProvider
;'。这一行发生了什么?对不起,我是一个新手角 –基本上只是为了演示,我没有注入一个$ stateParams依赖项,然后我正在阅读状态参数&创建控制器的名称.. **我写的代码只是为了演示,评论** –
我知道了。这里可能有$ rootScope依赖关系吗? –