简体   繁体   English

该ui状态定义中的控制器在哪里定义?

[英]Where is the controller defined in this ui-state definition?

I am looking at an angularjs app with an UI-staterouter. 我在看带有UI状态路由器的angularjs应用。 The router looks like this: 路由器如下所示:

  .state('root.one.detail.more', {
                url: '/:section',
                controllerAs: 'vm',
                bindToController: true,
                templateProvider: function ($stateParams, $templateCache) {
                    return $templateCache.get($stateParams.stage + '.html');
                },.....

My question is: based on this codesample can you tell me what the controllerAs property refers to. 我的问题是:根据此代码示例,您能否告诉我controllerAs属性所指的是什么。 It says vm but where can I find the actual controller? 它说的是vm,但在哪里可以找到实际的控制器?

I think the "controllerAs" will define a variable that will reference your controller in application, so... acording to your code, the controller is not defined. 我认为“ controllerAs”将定义一个变量,该变量将在应用程序中引用您的控制器,因此...根据您的代码,未定义控制器。

You may see this answer to better understand the route configuration Using 'controller as' with the ui-router isn't working as expected 您可能会看到此答案以更好地了解路由配置ui路由器与“ controller as”一起使用无法正常工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM