How might I move AngularJS Routes into separate file

后端 未结 3 1833
滥情空心
滥情空心 2021-02-01 07:51

I was curious if anybody was familiar with separating routes from the main app config function. My route list is getting quite large and I wanted to move them into a separate fi

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-01 08:30

    You can put your config function in a separate file easily:

    App-config.js

       angular.module('app').config(function(...){...});
    

    Just make sure you include the module definition before you include App-config.js.

    App-module.js

      angular.module('app',[...]).controller(...).etc
    

提交回复
热议问题