Questions tagged [angularjs-ng-include]

Fetches, compiles and includes an external HTML fragment.

Fetches, compiles and includes an external HTML fragment.

Usage

As element: (This directive can be used as custom element, but be aware of IE restrictions).

<ng-include
  src=""
  [onload=""]
  [autoscroll=""]>
...
</ng-include>

As attribute:

<ANY
  ng-include=""
  [onload=""]
  [autoscroll=""]>
...
</ANY>

As CSS class:

<ANY class="ng-include: ; [onload: ;] [autoscroll: ;]"> ... </ANY>

Reference:
https://docs.angularjs.org/api/ng/directive/ngInclude

469 questions
18
votes
1 answer

How to nest ng-view inside ng-include?

When trying to add an ng-view inside an ng-include, nothing happens. e.g. in the following code, when themes/midnight/index.html holds an ng-view, no view is rendered: However, if I use…
ccoroom
  • 699
  • 9
  • 23
17
votes
2 answers

Angular (1.5.8) Dynamic Components

I'm trying to build a sort of dynamic dashboard using Angular 1.5.8. I've made decent progress up until the final hurdle. Which is actually rendering the dynamic component. I've tried 2 options, either adding a ui-view and programatically passing…
Rohan Büchner
  • 5,333
  • 4
  • 62
  • 106
15
votes
1 answer

How to attach navbar only on certain pages using ui-router?

How to display a navbar on every page except landingpage, so that not have to attach a navbar file on each of needed pages? Now I have enclosed navbar on main app layout, how it should be handled to keep it DRY? Demo (with navbar on each…
15
votes
2 answers

AngularJS: ngInclude and dynamic URLs

I'm using the ngInclude directive to load HTML fragments. Now I'm looking for the best way to pass a dynamic URL. I know I can create the URL with string concatenation:
Michael Weiss
  • 514
  • 1
  • 7
  • 15
14
votes
2 answers

Angularjs - Charts.js: Same chart element doesn't redraw on other view

I am new to angularjs, trying to create my first directive. I am creating a directive to load Charts.js2.0(beta) into my application. I have 2 views managed by angular-route, both html view has ng-included a html page that contains only…
14
votes
3 answers

ng-include, ng-template or directive: which one is better for performance

I would like to know the best way to design an angular app regarding performance, for building an HTML template with reusable widgets like header, sidebar, footer, etc. Basically the main content is the central DIV which will have its content…
guilhebl
  • 8,330
  • 10
  • 47
  • 66
13
votes
3 answers

Include an angular app in a div on an other domain, no iframe

I have an angular application which has all kinds of dependencies like modules and styles. On the other hand, I have multiple websites where I want to include this application with all dependencies (Like you have in an iFrame). I want to include the…
13
votes
1 answer

What file path would I use with ng-include?

My angular project's path is like this web server.py ##flask server program app static app.js controllers.js etc... templates index.html home.html index.html