Can I link to a specific file within a Plunker? Specifically, I'd like to use Angular's "templateUrl" within a directive to externalize the HTML for a directive I'm building:
myApp.directive('groupedlist', function() {
return {
restrict: 'E',
scope: true,
templateUrl: '/groupedList.html',
link: function() {}
};
});
I have a file called "groupedList.html" that contains a HTML template, but it seems like these are logical files within a Plunker project - my browser complains because it can't find groupedList.html. Is it possible to do what I'm trying to do using Plunker? I'd rather not use the "template" attribute because there is a not-insignificant amount of HTML content I'd like to externalize.
templateUrl doesnt work with absolute URLs, use relative URL instead (like './page.html' or '../templates/page.html'). If u need to load cross domain page to template, u can do a request (XMLHttpRequest) and set STRING HTML as a template.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With