angulartemplatesangularjs-ng-include

Angular2 split template file?


In Angular 1.5 I used to split up large template files by using ng-include. For example I had a template called layout.html that contained a sidebar, the header and the navigation, I included all of those three elements with ng-include. Gave me more overview than one large HTML template file.

Is there any way to solve this in Angular 2?


Solution

  • Angular 2 does not support ng-include. Here's a similar question with more answers: angular 2 include html templates

    But TL;DR: in Angular 2 the basic unit is a component, not a template.

    More in-depth discussion on GitHub here: https://github.com/angular/angular/issues/7596