Unknown provider switches from Angular 1.0 to 1.2.3

I am trying to upgrade from Angular 1.0 to Angular 1.2.3. I added angular -route.js as a dependency and added ngRoute wherever I think it should go. And that’s all I did to go from 1.0 to 1.2.3. I get the following errors:

Error: Unknown provider: $ sceProvider <- $ sce <- $ route <- ngViewDirective

Error: circular dependency: ngViewDirective

Here is the html snippet where is my ng-view:

<div id="wrapper" ng-controller='MyCtrl'> <div ng-include src="'application/nav.html'" ng-controller="NavCtrl"></div> <div id="content-main" ng-view></div> </div> 

So, I have controllers over the ng-view directive in dom. None of these controllers depend on ngRoute, just $ scope and $ location.

This works in 1.0, so it has something to do with switching to 1.2.3, but I don't see a problem.

Does anyone know what I'm missing here?

+7
angularjs
source share
2 answers

In AngularJS 1.2.1 , the route module was pulled in a single angular-route.min.js , you need to add a link to this file and angular-sanitize.min.js in accordance with the error you reported.

And you need to add ngRoute and ngSanitize to the application:

 var app = angular.module('nap.application', ['ngRoute', 'ngSanitize']); 
+12
source share

$sce is a security service in AngularJS, do you use ng-bind-html-unsafe in any partial downloads in ng-vew ? If so, you need to change them to ng-bind-html and enable the ngSanitize module.

+1
source share

All Articles