freetoplay
freetoplay

Reputation: 697

AngularJS ng-include won't work for some reason

So I'm using the following tags for AngularJS includes:

<div data-ng-include src="'../templates/footer.html'"></div> 

The footer file is in the templates directory and includes the following code

<footer class="primary-footer">
<div class="copyright"><small>&copy; 2015</small></div>
</footer>
</body>
</html> 

However when I load the page, the footer does not load. When I check the source, it gives me a 404 error. Am I just not accessing the right directory or is this something wrong with my code?

Upvotes: 1

Views: 288

Answers (2)

Deep Kakkar
Deep Kakkar

Reputation: 6305

Instead of:

<div data-ng-include src="'../templates/footer.html'"></div> 

Use:

<div data-ng-include data-src="'../templates/footer.html'"></div>

Upvotes: 2

Praveen Poonia
Praveen Poonia

Reputation: 765

Do it like - <div data-ng-include="'../templates/footer.html'"></div> or do it with ng-template like - <div ng-bind-template="'../templates/footer.html'"></div> both will solve your problem.

Upvotes: 2

Related Questions