I have this Plunkr ,
<script type="ng/template" id="/my-template.html?id=123">
Inline template. Yes!
</script>
app.directive('gameListing', function() {
return {
restrict: 'EA',
templateUrl: '/my-template.html?id=123'
};
but I cannot figure out why the h*ll Angular still tries to load the template, even though it's defined in the id-property of the script-tag.
Can anybody please help me out here? I would need to have this inline, not loading with (yet) another request.
Thanks!
Use this
<script type="text/ng-template" id="my-template.html?id=123">
Inline template. Yes!
</script>
app.directive('gameListing', function() {
return {
restrict: 'EA',
templateUrl: 'my-template.html?id=123'
};
as "/my-template.html?id=123" this path is relative to your root directive so it would try to find out in your root folder. please modify template id like - id="my-template.html?id=123" and access it in same way templateUrl: 'my-template.html?id=123'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.