Martin
Martin

Reputation: 24316

Angular 1.5: Recommended structure for component based application?

Up until now I have been building my application using the following structure.

/src
    /components
       /shared
          /messagebox
          /alertbox
       /Home
       /About

So as you can see I have shared components which are components being used on other components / pages. and I have the concept of Home, About which are also components (which translate to viewable pages) as everything in Angular is now supposed to be a component - right?

Does anyone have a better implementation of the structure of a NG 1.5 app?

I now need to create some filters and as far as I am aware I cannot hang these off of a component, so where is the based place for putting this type of file?

Also other things that come to mind are constants, services etc.

There is no recommendation on Angular docs site as far as I can see.

Upvotes: 1

Views: 689

Answers (1)

Aravind
Aravind

Reputation: 2330

The one which i used to follow for my project is :

project
  /www
    /assets
    /components           // directives
      /accordion
        /accordion.html
        /accordion-directive.js
        /accordion-controller.js
        /accordion-controller-test.js
    /core                 // shared services
       /route
         /router-service.js 
    /sections             // pages we build by adding components
       /registration-page
         /registration.html
         /registration-controller.js
         /registration-controller-test.js
    app.js         
    index.html
    index-controller.js
    app-configuration.json // for keeping constants

this might help you.Please check.

Upvotes: 1

Related Questions