I'm trying to use $ sce. I installed your code as follows:
var app = angular .module('app', ['ui.router', 'admin', 'home', 'questions', 'ngResource', 'ngSanitize', 'LocalStorageModule','ajoslin.promise-tracker']) .config(['$locationProvider', '$sce', '$sceProvider', '$stateProvider', function ($locationProvider, $sceProvider, $stateProvider) { $sceProvider.enabled(false); $locationProvider.html5Mode(true);
In the controller:
angular.module('questions') .controller('QuestionsContentController', ['$rootScope', '$sce', '$scope', '$http', '$resource', '$state', function ($rootScope, $sce, $scope, $http, $resource, $state) { var isNumber = !isNaN(parseFloat($state.params.content));
I checked and I have downloaded downloadable angular -sanitize.js v1.2.0-rc.3.
However, I get the message:
Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to: Error: [$injector:unpr] Unknown provider: $sce
Can anyone help me out by suggesting what I'm doing wrong. I followed the example as much as possible, but I can not understand what happened.
Some background:
I think I need to get $ sce, because I have data that I trust 100% and that I want to show on the screen. This is data containing "<" ">" "&" and something like this. I set $ sceProvider.enabled (false), but the data is still not displayed correctly. Then I thought what maybe I need to do:
$ Scope.content = data.text; $ Scope.unsanitizedQuestionText ($ sce.trustAsHtml (data.text))
and then in my HTML:
Is it right that I need?