0

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 ?

3
  • Possible duplicate: stackoverflow.com/questions/9381926/… Commented Dec 3, 2014 at 19:49
  • Angular has its own template system built in so you probably want to use that instead? Commented Dec 3, 2014 at 19:49
  • BelgianMyWaffle : I did not fit the proposed answers Commented Dec 3, 2014 at 20:16

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.