I have an application on angularJS. In the main index.html file the corresponding libraries are connected. Styles inside the body, ng-view is registered, several templates.

How to set them styles? For example, paige1.html - I want to connect style1.css, I think it is necessary to include styles in the main index.html file, and what if there is an overlap of styles?

  • What do you think overlapping styles? Usually different blocks of pages have different classes and, accordingly, styles. If you mean that you have different page (page1, page2 ... pageN), the elements in which have the same style names, but the styles themselves are different, and you need to load the necessary file for each page, then you will be saved only bandler. It will also help to load the necessary controllers related only to the selected page. - Mr. Brightside

1 answer 1

The application on AngularJS implies the principle of SPA.
Therefore, only markup should be included in the ng-view files, and all the main dependencies are written in the main index.html file.
And so that different styles are used for different blocks, it is enough to wrap these blocks (and styles for them) in containers using the class or id .

  • so and if the application grows huge and somewhere there will be the same class names or id - Dmitry
  • Well, after all, the principle is the same as on ordinary websites - the same classes for identical elements ... in good production, all files are concatenated into one, because a priori there should be no repetitions - lexxl
  • everything is clear thanks - Dmitry