Gopi
Gopi

Reputation: 163

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?

Upvotes: 4

Views: 273

Answers (2)

palingram blog
palingram blog

Reputation: 1

Depending on the reason behind so many partials your use of it may be justified. Generally when you have a lot of partials, it would be better for performance reason to use the $cacheFactory.Cache to store and retrieve the data in the clients browser.

Upvotes: 0

Oam Psy
Oam Psy

Reputation: 8663

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).

Upvotes: 3

Related Questions