Because I have never developed a real project with angular, I have a question.
The routing effect of angular can be used to create a single-page web. The routing is to load the html fragment.
If you want to use style css, more A style can only be linked in index.html, so how many css should be filled in for how many routes there are? Or the css is written in a file. If so, the style will be difficult to control;
I used to write one html corresponding to one css,
Use ocLazyload to load the corresponding controller, CSS, etc., or the files you want to load in conjunction with routing
I have done some AngularJS single-page applications.
During the development phase, I split the css files according to needs. Similar to what the questioner said, each route (I think it is a view) has one css. However, when publishing, I compressed all the css together using gulp, and then indexed them directly. The page is loaded, and the styles called in the view all come from the compressed css file.
Worked as a front-end intern for half a month and worked on the front-end of 5 or 6 projects.
Our company's approach is to write in less, and finally package and compress all the less files into a css file using process tools such as gulp/grunt/fis3... and just reference this css file directly on the interface.
It is recommended to write the css in a file.
At the same time, the html template is also written in
$templateCache
. In this way, although the homepage may open slowly, the subsequent operations will be smooth and smooth. Moreover, use the caching strategy to consolidate these large files. The files are cached, and there will be no obvious lag when accessing the homepage later.