0

I'm trying to create a html fragement that should lateron serve as an image slider. So far it only contains a test div element:

slider.html:
<div>TEST</div>

I'm trying to include this in my index.html as follows:

<div ng-include src="slider.html"></div>

Result: I don't see the test div. Why?

membersound
  • 81,582
  • 193
  • 585
  • 1,120

3 Answers3

3

Try this:

<div ng-include="'slider.html'"></div>

When using a path in ng-include you need to enclose it with single quotes, since it expects an expression.

From the docs:

If the source is a string constant, make sure you wrap it in single quotes, e.g. src="'myPartialTemplate.html'".

Martijn
  • 24,441
  • 60
  • 174
  • 261
1
<ng-include src="'slider.html'"></ng-include>

or

<div ng-include src="'slider.html'"></div>
Shrinivas Pai
  • 7,491
  • 4
  • 29
  • 56
0

You can include another html like below:

<div ng-include src = "'partials/myModule/myHtml.html'"></div>

It has already been answered here:
https://stackoverflow.com/a/31609423/5052704

Hope this helps.

Community
  • 1
  • 1
Vipul Agarwal
  • 1,513
  • 3
  • 14
  • 24