How to use ng-include?


#1

What value should be passed to ng-include attribute so I could place multiple html pages onto a single page? Will the scope be shared between all of the pages?


#2

You pass in the relative path of the page but must surround it in single quotes because it is an Angular expression:

ng-include="'page.html'"

#3

The Visualisations sample in Canvas uses the ng-include:

If you want more explanation about ng-include, you can have a look at the following help article:


#4

The path used in ng-include has to be relative to the url in the browser. So if the file is in the folder html/page.html it would be:

ng-include="'html/page.html'"

#5

I found it’d better to put ng-include in the end of the page (after a table), if modals are used in ng-include html files. Otherwise modal pop-ups behaviour can be strange, I guess because of scope variables updating is waiting for the table refresh.