First of all, I will try to rely on this AngularJS functionality as much as possible. There are three ways to implement the header and footer in the application:
The reason you would like to use this is because simplicity and less code. From the docs:
Defines, compiles, and includes an external HTML fragment
This way it just includes an external html snippet.
- ng-view
This is the default router in Angular (prior to 2.0), and there is a better ui-router option.
UI-Router is a routing framework for AngularJS created by the AngularUI team. It offers a different approach than ngRoute, in that it changes the presentation of applications based on the state of the application, and not just the route URL.
It supports features such as nested views, etc. The main reason for its use would be the separation of controllers and areas of these representations. In terms of headers and footers, if you want to have a completely separate logic inside, then follow it.
- custom directive
This option should be used if you have a logical overlap in the main content area and in the header / footer. Also you get additional benefits with it, like reuse, etc.
So, your choice is to choose one, but do not be lazy to search and read ( here , here , here or here ) before writing.
source share