I'm trying to migrate from Angular 1.0 to Angular 1.2.3. I have added angular-route.js as a dependency and added ngRoute everywhere I believe it should go. And that is all I've done to move from 1.0 to 1.2.3 I'm getting the following errors:
Error: Unknown provider: $sceProvider <- $sce <- $route <- ngViewDirective
Error: Circular dependency: ngViewDirective
Here is a snippet of the html where my ng-view is:
<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 above the ng-view directive in the dom. Neither of these controllers have dependency on ngRoute, just $scope and $location.
This works in 1.0 so it has something to do with moving to 1.2.3 but I'm not seeing the issue.
Does anyone know what I'm missing here?
In AngularJS 1.2.1, the route
module have been pulled out in a single file angular-route.min.js
, you need to add the reference to this file and angular-sanitize.min.js
according to the error you posted.
And you need to inject ngRoute
and ngSanitize
in the app as well:
var app = angular.module('nap.application', ['ngRoute', 'ngSanitize']);
$sce
is a security service in AngularJS, are you happening to use ng-bind-html-unsafe
in any partials being loaded into ng-vew
? If so, you need to change those to ng-bind-html
and include the ngSanitize
module.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With