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

467 questions
9
votes
1 answer

Angular and jQuery ng-include with document.ready not working

I am trying to load a component which is placed in a separate html using HMTL. The problem is that it is to be invoked as soon as the page is loaded in the browser. Below is my Modal Code:
9
votes
3 answers

ng-repeat with ng-include not working

I am trying to use an ng-repeat that includes an ng-include. The problem is that the first element in the ng-repeat is just the ng-include template with none of the data from the ng-repeat filled in. Is there a way I can somehow bind the template…
Chris Paterson
  • 1,099
  • 3
  • 18
  • 28
9
votes
1 answer

How to change "src" attribute value of ng-include in angularJS after first load?

On a keyboard event I want to change the ng-include directive's src value dynamically.
D.S
  • 1,050
  • 3
  • 10
  • 26
8
votes
1 answer

Angular JS: include partial HTML inside another ng-include

I'm using an index.html created with Yeoman, that looks something like this: ...
Now, I know that I cannot use an ng-include inside another…
domokun
  • 2,995
  • 3
  • 27
  • 55
8
votes
2 answers

Can I have nested ng-include's?

I have a template that is inserted via ng-include and that template also has an ng-include. The inner ng-incude is not being shown. Why? Main Template:
views/outer.html:
Chris Paterson
  • 1,099
  • 3
  • 18
  • 28
8
votes
1 answer

how to catch angular ng-include error

When I use ng-include as a title, how do I catch the error when the address (file path) does not exist? I finished a ng-include router inside a ng-view(with ng-route), It's a little bit like this: ContentCtrl: var content =…
Tyler.z.yang
  • 2,260
  • 1
  • 15
  • 30
8
votes
1 answer

angularjs / rendering Performance difference between inlining or using ng-include

I can use ng-include to include a partial inside an angular view or I can use server side partials to do it on the server. I'm thinking about using server side partials instead of angular partials and then ng-include (with the script tag) because I…
Harry
  • 47,045
  • 66
  • 163
  • 243
7
votes
3 answers

Validation does not work if its in ng-include

I have a simple page with validating the field, something like this: employee.html and its validating the field but if I have added the same code and called the same page using ng-include the validating is not working without ng-include validate…
Nick Kahn
  • 18,273
  • 84
  • 260
  • 388
7
votes
2 answers

AngularJS ng-include: onload calling a function defined in included controller

Using AngularJS, is it possible to use the "onload" argument to trigger a function defined inside a "child" controller (a controller called by the included template)? Example:
Matteo Piazza
  • 2,332
  • 6
  • 27
  • 38
7
votes
1 answer

Directives inside ng-include

I'm building a simple angularjs app and I'm trying to implement login without page refresh. What I'm doing On init the ng-include loads the /set/save. The /set/save got the Login with Facebook in it. So when clicked the directive…
7
votes
1 answer

ng-include - Controller is called multiple times

Situation: I am trying to include a partial with ng-include without the need for any routing. I just want to include a specific partial of many dynamically. This is more or less how it looks like:
//This…
markus
  • 38,729
  • 23
  • 95
  • 139
6
votes
2 answers

Inline `ng-template` not found by `ng-include`

I have a view being loaded with an embedded text/ng-template which is not being found by a ng-include later in the file. The script block sits at the very top of the view file: