Using 'controller as' with the ui-router isn't working as expected

后端 未结 5 846
耶瑟儿~
耶瑟儿~ 2021-02-02 10:35

I have the following state setup for a page using an abstract state and the controller as syntax:

# Details page route
.state \'title\', 
  url: \'/title\',
  ab         


        
5条回答
  •  再見小時候
    2021-02-02 10:55

    In your state configuration :

    Instead of controller: 'Title as t', try :

    controller: 'Title',
    controllerAs: 't'
    

    Edit : Just implemented a minimal app with ui-router and the syntax controller: Title as t also works, in versions 0.2.0 of ui-router to the most recent one as of today. I can see the t instance when I inspect angular scopes.

提交回复
热议问题