AngularJS application file structure

后端 未结 6 1101
有刺的猬
有刺的猬 2020-11-30 20:05

On a large AngularJS application having all my controllers in a single \"controllers.js\" file seems a little un-maintainable to me. Is there a better way to do this such as

6条回答
  •  被撕碎了的回忆
    2020-11-30 20:43

    You can manage it like module wise!!

    For example , take user view , you make one directory, here its name is user!!

    user // directory , now put all controller ,service and directive file into it !! 
    
    -- userController.js    //  controller file 
    
    -- userService.js       // service file
    
    -- userDirective.js     // directive file
    
    -- views                // make directory, and put all html file regarding that module into this
    
      --users.html          // html file
    

    Hope this will help you!!

提交回复
热议问题