Upgraded angularjs from 1.3.16 to 1.5.3 - getting error

1,283 views
Skip to first unread message

Paul Sperneac

unread,
Apr 14, 2016, 10:39:54 AM4/14/16
to foam-framework-discuss
Hi,

I'm getting the following error after I upgraded angularjs.

Failed to instantiate module ng due to:
TypeError: Cannot set property 'aHrefSanitizationWhitelist' of null

I've tested that it is indeed foam related by removing the loading of the foam.js I have. Any chance you can take a look?

Index.html: (foam.js and angular.min.js attached....
....
<!-- build:js(.) resources/js/init.js -->
<script src="resources/js/app/init.js"></script>
<!-- endbuild -->

<!-- build:js(.) resources/js/vendor.js -->
<script src="resources/bower-lib/foam/foam.js"></script>

<script src="resources/bower-lib/jquery/jquery.min.js"></script>
<script src="resources/bower-lib/angular/angular.min.js"></script>
<script src="resources/bower-lib/angular-local-storage/angular-local-storage.min.js"></script>
<script src="resources/bower-lib/angular-sanitize/angular-sanitize.min.js"></script>
<script src="resources/bower-lib/angular-translate/angular-translate.min.js"></script>
<script src="resources/bower-lib/angular-translate-loader-url/angular-translate-loader-url.min.js"></script>
<script src="resources/bower-lib/angular-ui-router/angular-ui-router.min.js"></script>
<script src="resources/bower-lib/angular-selection-model/selection-model.min.js"></script>
<script src="resources/bower-lib/fastclick/fastclick.js"></script>
<script src="resources/bower-lib/modernizr/modernizr.js"></script>
<script src="resources/bower-lib/moment/moment.min.js"></script>
<script src="resources/bower-lib/moment-timezone/moment-timezone-with-data.min.js"></script>
<script src="resources/bower-lib/re-tree/re-tree.min.js"></script>
<script src="resources/bower-lib/ng-device-detector/ng-device-detector.min.js"></script>
<script src="resources/bower-lib/respond/respond.min.js"></script>
<script src="resources/bower-lib/bootstrap/bootstrap.min.js"></script>
<script src="resources/bower-lib/bootstrap3-dialog/bootstrap-dialog.min.js"></script>
<script src="resources/bower-lib/lodash/lodash.min.js"></script>
<!-- endbuild -->

<!-- build:js(.) resources/js/app.js -->

<!-- <script src="resources/js/app/model/foamModels.js"></script> -->

<script src="resources/js/app/app.js"></script>
<script src="resources/js/app/main/main.controller.js"></script>

...
angular.min.js
foam.js

Paul Sperneac

unread,
Apr 14, 2016, 10:44:21 AM4/14/16
to foam-framework-discuss
Same error, this time with non-minified version of angular:

Failed to instantiate module ng due to:
TypeError: Cannot set property 'aHrefSanitizationWhitelist' of null


on ui:

angular.js:68 Uncaught Error: [$injector:modulerr] Failed to instantiate module ng due to:
TypeError: Cannot set property 'aHrefSanitizationWhitelist' of null
http://errors.angularjs.org/1.5.3/$injector/modulerr?p0=ng&p1=TypeError%3A%…sehost%2Fmobile%2Fresources%2Fbower-lib%2Fangular%2Fangular.js%3A4518%3A35)

(anonymous function) @ angular.js:68
(anonymous function) @ angular.js:4547
forEach @ angular.js:321
loadModules @ angular.js:4508
createInjector @ angular.js:4430
doBootstrap @ angular.js:1710
bootstrap @ angular.js:1731
angularInit @ angular.js:1616
(anonymous function) @ angular.js:30709
j @ jquery.js:3148
k.fireWith @ jquery.js:3260
m.extend.ready @ jquery.js:3472
J @ jquery.js:3503
angular.js

Kevin Greer

unread,
Apr 14, 2016, 1:51:08 PM4/14/16
to Paul Sperneac, foam-framework-discuss
Hi Paul,

  Looks like others had similar issues with Angular 1.5:


"I had the exact same problem when I upgraded to angular 1.5.0.
The problem turned out to be with a custom implementation of Function.prototype.bind that we had in our code, it looks like this interfered with the one defined in angular."

FOAM also redefines a custom Function.prototype.bind(), so that's probably the issue.  Try deleting lines 759-779 in foam/core/stdlib.js and see if that fixes it.  If it does then we'll have to look and see what Angular is doing and then either submit a patch to Angular or else try to work around what they're doing in FOAM.

Regards,

KGR


--
You received this message because you are subscribed to the Google Groups "foam-framework-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to foam-framework-discuss+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kevin Greer

unread,
Apr 15, 2016, 11:11:19 AM4/15/16
to Paul Sperneac, foam-framework-discuss
Or, if you don't want to modify the foam lib, just load it this way:

var tmp = Function.prototype.bind;

<load the foam lib here>

Function.prototype.bind = tmp;


FOAM replaces bind() with a faster version (10X faster), but doesn't require it.


To unsubscribe from this group and stop receiving emails from it, send an email to foam-framework-discuss+unsubscri...@googlegroups.com.

Kevin Greer

unread,
Mar 20, 2017, 10:56:02 AM3/20/17
to foam-framework-discuss, gep...@gmail.com
BTW, FOAM2 no longer has this problem. The only global FOAM2 creates is 'foam' and, unlike FOAM1, it doesn't modify any built-in prototypes.
Reply all
Reply to author
Forward
0 new messages