Reputation: 3591
controller
define(['angular', 'services','text',
'text!ang/templates/dinamic.html'], function (angular,s,t,template) {
var _temp = template;
return angular.module('myApp.controllers', ['myApp.services'])
.controller('MyCtrl1', ['$scope', 'version', function ($scope, version) {
$scope.scopedAppVersion = template ;
}])
})
template is HTML text : dinamic.html
<p><b> Dinamic Url Text template</b></p>
index.html :
<div ng-controller="MyCtrl1">{{scopedAppVersion}}</div>
In browser i see <p><b> Dinamic Url Text template</b></p>
.He don't parse HTML - tags .
How to fix ?
Upvotes: 0
Views: 123
Reputation: 468
For example you can use following solution
view
<div ng-controller="MainCtrl" ng-include="templateUrl"></div>
app
app.constant('templateUrl', '1.html')
.controller('MainCtrl', function($scope, templateUrl, $sce) {
$scope.templateUrl = $sce.trustAsResourceUrl(templateUrl);
});
demo http://plnkr.co/edit/Nr9FwN?p=preview
Upvotes: 2