I've this in my main layout file
<body>
<header id="header" ng-controller="HeaderController"></header>
<div class="container" ng-view></div>
I've a header.html partial template in my directory structure.
How to include this template in my app? I thought angular automatically includes the template after processing the controller, but it doesnt work.
The header node should be replaced with the content of this file.
One way of including templates/html fragments from external files is to use the
ng-include
directive (doc).or
From
Angular 2
,ngInclude
has been removed and custom directives are preferred. This is the way I come up withDefine the main component for your app, which link to the master page
And this is the main template
base.html
, which will contain the body tag and the app tag<body> <app>Loading ...</app> </body>
Navigation
andFooter
like the MainComponent, which point to your partial templates