Reputation: 50
I am newbie to angularjs and i have to know the code structure and directory structure in angularjs
My directory Structure
My Doubts are
1)I want to know is the above directory structure is correct
2)Is it advisable to use controller for every individual module separately
3)Is correct way to write all run ,config and declaring module plugin in the same file (ex:app.js)
Upvotes: 1
Views: 471
Reputation: 86740
I want to know is the above directory structure is correct.
Its totally depends on you how would you organize you project setup, there is nothing hard and fast rule that you have to follow to setup your project structure. well if we talk about your structure it seems to be good setup you have established except images folder i would prefer image folder in the asset folder. otherwise your setup seems to be fine.
is it advisable to use controller for every individual module separately
Yes, its good practice to use a separate controller for every module, and categorize them as per you folder structure.
although there are a lot of projects are there from where you can easily got your all answers, also there are many popular repository's are there which describe the best folder structure for the project setup you can also refer to most popular style guide of angular here -
https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#application-structure
https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md
Upvotes: 0
Reputation: 1891
There is most widely accepted style guide for angularjs projects even angular team support this style guide by john papa. He is the active member in the angular core community. He has created style guide for angular1 and angular2.
even you can use yeoman tool to get scaffolding done for you and they follow these style guide angular project generator.
follow the instruction, after that it will be like
yo angular [app-name]
Upvotes: 1