0

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] http://errors.angularjs.org/1.5.0/$injector/modulerr?p0=inspinia&p1=Error%3A%20%5B%24injector%3Amodulerr%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.5.0%2F%24injector%2Fmodulerr%3Fp0%3Doc.lazyLoad%26p1%3DError%253A%2520%255B%2524injector%253Anomod%255D%2520http%253A%252F%252Ferrors.angularjs.org%252F1.5.0%252F%2524injector%252Fnomod%253Fp0%253DngSanitize%250A%2520%2520%2520%2520at%2520http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fangular%252Fangular.min.js%253A6%253A416%250A%2520%2520%2520%2520at%2520http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fangular%252Fangular.min.js%253A25%253A136%250A%2520%2520%2520%2520at%2520b%2520(http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fangular%252Fangular.min.js%253A24%253A188)%250A%2520%2520%2520%2520at%2520Object.module%2520(http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fangular%252Fangular.min.js%253A24%253A431)%250A%2520%2520%2520%2520at%2520u%2520(http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fplugins%252Foclazyload%252Fdist%252FocLazyLoad.min.js%253A8%253A2925)%250A%2520%2520%2520%2520at%2520Object.n%2520%255Bas%2520forEach%255D%2520(http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fangular%252Fangular.min.js%253A7%253A355)%250A%2520%2520%2520%2520at%2520u%2520(http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fplugins%252Foclazyload%252Fdist%252FocLazyLoad.min.js%253A8%253A2994)%250A%2520%2520%2520%2520at%2520http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fplugins%252Foclazyload%252Fdist%252FocLazyLoad.min.js%253A8%253A3048%250A%2520%2520%2520%2520at%2520Object.n%2520%255Bas%2520forEach%255D%2520(http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fangular%252Fangular.min.js%253A7%253A355)%250A%2520%2520%2520%2520at%2520u%2520(http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fplugins%252Foclazyload%252Fdist%252FocLazyLoad.min.js%253A8%253A3026)%250A%2520%2520%2520%2520at%2520new%2520%253Canonymous%253E%2520(http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fplugins%252Foclazyload%252Fdist%252FocLazyLoad.min.js%253A8%253A3511)%250A%2520%2520%2520%2520at%2520Object.instantiate%2520(http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fangular%252Fangular.min.js%253A41%253A396)%250A%2520%2520%2520%2520at%2520c%2520(http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fangular%252Fangular.min.js%253A38%253A348)%250A%2520%2520%2520%2520at%2520Object.provider%2520(http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fangular%252Fangular.min.js%253A38%253A290)%250A%2520%2520%2520%2520at%2520d%2520(http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fangular%252Fangular.min.js%253A39%253A234)%250A%2520%2520%2520%2520at%2520http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fangular%252Fangular.min.js%253A39%253A340%250A%2520%2520%2520%2520at%2520n%2520(http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fangular%252Fangular.min.js%253A7%253A355)%250A%2520%2520%2520%2520at%2520g%2520(http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fangular%252Fangular.min.js%253A39%253A135)%250A%2520%2520%2520%2520at%2520http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fangular%252Fangular.min.js%253A39%253A304%250A%2520%2520%2520%2520at%2520n%2520(http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fangular%252Fangular.min.js%253A7%253A355)%250A%2520%2520%2520%2520at%2520g%2520(http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fangular%252Fangular.min.js%253A39%253A135)%250A%2520%2520%2520%2520at%2520fb%2520(http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fangular%252Fangular.min.js%253A43%253A164)%250A%2520%2520%2520%2520at%2520c%2520(http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fangular%252Fangular.min.js%253A20%253A449)%250A%2520%2520%2520%2520at%2520Ac%2520(http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fangular%252Fangular.min.js%253A21%253A259)%250A%2520%2520%2520%2520at%2520fe%2520(http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fangular%252Fangular.min.js%253A20%253A69)%250A%2520%2520%2520%2520at%2520HTMLDocument.%253Canonymous%253E%2520(http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fangular%252Fangular.min.js%253A306%253A372)%250A%2520%2520%2520%2520at%2520j%2520(http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fjquery%252Fjquery-3.1.1.min.js%253A2%253A29948)%250A%2520%2520%2520%2520at%2520k%2520(http%253A%252F%252Flocalhost%252Fa%252Fjs%252Fjquery%252Fjquery-3.1.1.min.js%253A2%253A30262)%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%2Fa%2Fjs%2Fangular%2Fangular.min.js%3A6%3A416%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%2Fa%2Fjs%2Fangular%2Fangular.min.js%3A40%3A60%0A%20%20%20%20at%20n%20(http%3A%2F%2Flocalhost%2Fa%2Fjs%2Fangular%2Fangular.min.js%3A7%3A355)%0A%20%20%20%20at%20g%20(http%3A%2F%2Flocalhost%2Fa%2Fjs%2Fangular%2Fangular.min.js%3A39%3A135)%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%2Fa%2Fjs%2Fangular%2Fangular.min.js%3A39%3A304%0A%20%20%20%20at%20n%20(http%3A%2F%2Flocalhost%2Fa%2Fjs%2Fangular%2Fangular.min.js%3A7%3A355)%0A%20%20%20%20at%20g%20(http%3A%2F%2Flocalhost%2Fa%2Fjs%2Fangular%2Fangular.min.js%3A39%3A135)%0A%20%20%20%20at%20fb%20(http%3A%2F%2Flocalhost%2Fa%2Fjs%2Fangular%2Fangular.min.js%3A43%3A164)%0A%20%20%20%20at%20c%20(http%3A%2F%2Flocalhost%2Fa%2Fjs%2Fangular%2Fangular.min.js%3A20%3A449)%0A%20%20%20%20at%20Ac%20(http%3A%2F%2Flocalhost%2Fa%2Fjs%2Fangular%2Fangular.min.js%3A21%3A259)%0A%20%20%20%20at%20fe%20(http%3A%2F%2Flocalhost%2Fa%2Fjs%2Fangular%2Fangular.min.js%3A20%3A69)%0A%20%20%20%20at%20HTMLDocument.%3Canonymous%3E%20(http%3A%2F%2Flocalhost%2Fa%2Fjs%2Fangular%2Fangular.min.js%3A306%3A372)%0A%20%20%20%20at%20j%20(http%3A%2F%2Flocalhost%2Fa%2Fjs%2Fjquery%2Fjquery-3.1.1.min.js%3A2%3A29948)%0A%20%20%20%20at%20k%20(http%3A%2F%2Flocalhost%2Fa%2Fjs%2Fjquery%2Fjquery-3.1.1.min.js%3A2%3A30262)
    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 $sce and $sanitize (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)

and

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

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

6
  • Have you included angular-sanitize.js in your html ? Commented Sep 30, 2017 at 13:16
  • But there are no errors prior to injecting sanitize and sce ... ? If I remove them, there are no errors in the dev console Commented Sep 30, 2017 at 13:18
  • 1
    $sanitize will only work after adding angular-sanitize.js .. did you added that ? Commented Sep 30, 2017 at 13:20
  • Lolx - no one told me about that! I thought that it was a standard part of Angular (blush) Commented Sep 30, 2017 at 13:26
  • 1
    BTW in demo i wrote - imported angular-sanitize.js :) Commented Sep 30, 2017 at 13:53

1 Answer 1

1

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] http://errors.angularjs.org/1.5.0/$injector/nomod?p0=ngSa...

and

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.

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

7 Comments

I have injected it, but now I get a new error (please see updated question). I will research that &should post a new question if necessary
Angular core packages are suited to work seamlessly with each other. An error like this one that addresses package internals usually means that package versions were mismatched - like in your case. It's 1.5 angular and 1.2.25 sanitize.
Where do you see that? When I look at the source, it is 1.5, and the whole angular directory came as one with the Inspinia framework and I have made no changes to that dorectory
Saw 1.2.25 version in the example you've posted, jsfiddle.net/e6p244xt . And 1.5.0 was mentioned in the question. If your case is more complex than mismatched versions, I'd suggest to address this problem in a new question and provide stackoverflow.com/help/mcve that can replicate the issue.
@MawgsaysreinstateMonica The link is likely too long, at least the link that was provided in the OP. Try to truncate it to fit reasonable URL length (2000 chars). Since there was a degradation and the link was workable at the time when the question was posted, consider reporting the issue to github.com/angular/angularjs.org/issues , although I'm not sure if it will be ever fixed.
|

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.