Search code examples
angularjsangularjs-ng-include

Is there any limitation to use ng-include


I am developing a product. There, i am separating a page with so many templates, use atleast 5-8 ng-include per page. is there any problem to use so many ng-include in a page?


Solution

  • The major problem is that each ng-include generates a http request, which will impact the page load times.

    If all your doing is splitting up a page, you have a couple of options:

    1. Create directives, if your HTML can be used in others areas of your app.
    2. Use a templating engine like handlebars and a preprocessor to combine all the partials, in to a single page, like GulpJS or Grunt (i prefer Gulp).