Easier organisation of routes in Angular.js(medium.com)

6 years ago from Dominik Schmidt, kreativgebiet.com

  • Wouter De LooseWouter De Loose, 6 years ago (edited 6 years ago )

    In large Angular.js projects, it's much easier to organise your routes in a good directory structure

    For example:

    - routes - Templates // A separate folder that contains parent templates which other routes will use. - users // List of user (/users) - users.route.js - users.controller.js - user.template.js - user // Individual user (user/:user) - user.route.js - user.controller.js - user.template.js - edit // Edit user (user/:user/edit) - edit.route.js - edit.controller.js - edit.template.js - settings // Settings ( /settings) - settings.route.js - settings.controller.js - settings.template.js - notifications // Notifications settings ( /settings/notifications) - notifications.route.js - notifications.controller.js - notifications.template.js

    And so on, if you are looking for user/:user/edit, you instantly know where to look based on the folder directory.

    I've been using this method for a while now in some large Angular.js projects, and found it to be really helpful.

    0 points
    • Dominik Schmidt, 6 years ago

      So, with the method I mentioned in the article, it's mostly up to you how you structure your directories, just wanted to show how it could look like.

      0 points