Mawg Mawg - 3 years ago 173
AngularJS Question

AngularJs injection error

My sample, very basic, skeleton app works just fine. Then I tried to add @MaximShoustin answer from this question - Plunk here.

And I get

jquery-3.1.1.min.js:2 Uncaught Error: [$injector:modulerr]$injector/modulerr?p0=inspinia&
at angular.js:38
at angular.js:4526
at n (angular.js:321)
at g (angular.js:4487)
at fb (angular.js:4409)
at c (angular.js:1691)
at Ac (angular.js:1712)
at fe (angular.js:1606)
at HTMLDocument.<anonymous> (angular.js:30423)
at j (jquery-3.1.1.min.js:2)
at k (jquery-3.1.1.min.js:2)

Here's what ought to be the relevant code to inject
(I added the last two parameters to the controller and the last entry in the module) - what am I doing wrongly?

function MainCtrl($rootScope, $scope, $http, $interval, $state, $location, $sanitize, $sce)


(function () {
angular.module('inspinia', [
'ui.router', // Routing
'oc.lazyLoad', // ocLazyLoad
'ui.bootstrap', // Ui Bootstrap
'ui.grid', // Grid

beyond that, the only change is to add

<iframe ng-src="{{cvTrustedUrl}}"></iframe>

into the view

[Update] I injected ngSantize, but now I get

angular-sanitize.js:19 Uncaught TypeError: Cannot read property '$$minErr' of undefined
at angular-sanitize.js:19
at angular-sanitize.js:6
(anonymous) @ angular-sanitize.js:19
(anonymous) @ angular-sanitize.js:6

Answer Source

Error message contains a link to the page where the cause of the problem is explained in human-readable form with a stack of errors:

Failed to instantiate module oc.lazyLoad due to:

Error: [$injector:nomod]$injector/nomod?p0=ngSa...


Module 'ngSanitize' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

ngSanitize module should be loaded at the moment when the application is being bootstrapped.

It is also preferable to use unminified packages in order to improve the readability of call stack.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download