Reputation: 2001
Is it possibile in angular to load templates without web server, I found one example here: https://groups.google.com/forum/#!topic/angular/LXzaAWqWEus but for me it is only printing templates paths not content for them.
Is there any working example for this?
Upvotes: 2
Views: 930
Reputation: 2831
I'm ignoring the "no web server" part of the question. Here's an example on how you can put a template directly in a script tag and use it with a directive.
<body ng-app="myApp">
<script type="text/ng-template" id="templateTemplate.html">
<div>
I am the <span ng-transclude>{{templateAdjective}}</span>
template result.
</div>
</script>
<div>
<test>best</test>
<test>optimal</test>
</div>
<script>
var app = angular.module('myApp',[]);
app.directive('test', function() {
return {
restrict: 'E',
templateUrl: 'templateTemplate.html',
transclude: true,
replace: true
};
});
</script>
</body>
template in script tag jsfiddle
Upvotes: 1