Answer the question
In order to leave comments, you need to log in
What is the best way to organize code in angularjs?
There is an application with ui-view, where html is loaded by url. Need footer and header in app. The question is, is it better to insert head and footer directives loaded by url into each page, or do something like this in index.html:
<div ng-controller="top" header></div>
<div class="app" ui-view >
<div ng-controller="bottom" footer></div>
Answer the question
In order to leave comments, you need to log in
It really depends on the complexity of the code and the overall architecture. But if everything is simple, then for the footer I would just register it directly in index.html or use ngInclude .
With a header it is more difficult. There may be navigation and all that. If it is not complicated, then you can write it directly in the file. And if there is a lot of code, then you can also use ngInclude
it $rootScope
in run
.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question