Reputation: 1291
So I have a dialog directive that I'm using in a template. I'm doing something like:
<my-dialog>
<div>
<ng-include src="'myTemp.html'"></ng-include>
</div>
<my-dialog>
For some weird reason when I open my dialog, nothing appears when it's opened the first time. The second time populates my dialog with myTemp.html. Do I need to do things with $templateCache to notify angular about myTemp.html so that it works the first time?
Sorry I did have the '' around the src, I just forgot to add it for this submission =/.
Upvotes: 1
Views: 126
Reputation: 11740
src in the ng-include tag expects an expression. so to pass it a string you need to put quote around it:
<ng-include src="'myTemp.html'"></ng-include>
Upvotes: 1
Reputation: 1794
ng-include
src
is expecting a variable, isn't it?
So, I'm guessing that the src in your example should be wrapped in ''
. So, it will be:
<ng-include src="'myTemp.html'"></ng-include>
See if that helps.
Here's the official documentation: https://docs.angularjs.org/api/ng/directive/ngInclude
Upvotes: 1