Angular Ui Router Needs Polyfill

less than 1 minute read

This problem was Fixed version 1.0.20!! (thanks betty!)

In IE(Internet Explorer) 11, Angular-UI-Router(v1.0.19) with AngularJS and ocLazyLoad failed to instantiate.

SCRIPT5022: [$injector:modulerr] Failed to instantiate module majorApp due to:
Error: [$injector:modulerr] Failed to instantiate module ui.router due to:
Error: [$injector:modulerr] Failed to instantiate module ui.router.init due to:
TypeError: Object doesn't support property or method 'find'
   at getParamDeclaration (http://unpkg.com/@uirouter/angularjs/release/angular-ui-router.js:1603:9)
   at Param (http://unpkg.com/@uirouter/angularjs/release/angular-ui-router.js:1667:13)
   at ParamFactory.prototype.fromConfig (http://unpkg.com/@uirouter/angularjs/release/angular-ui-router.js:5044:13)
   at makeConfigParam (http://unpkg.com/@uirouter/angularjs/release/angular-ui-router.js:2732:59)
   at Anonymous function (http://unpkg.com/@uirouter/angularjs/release/angular-ui-router.js:515:50)
   at forEach (https://ajax.googleapis.com/ajax/libs/angularjs/1.7.2/angular.js:401:11)
   at map (http://unpkg.com/@uirouter/angularjs/release/angular-ui-router.js:515:9)
   at paramsBuilder (http://unpkg.com/@uirouter/angularjs/release/angular-ui-router.js:2734:13)
   at Anonymous function (http://unpkg.com/@uirouter/angularjs/release/angular-ui-router.js:2929:105)
   at StateBuilder.prototype.build (http://unpkg.com/@uirouter/angularjs/release/angular-ui-router.js:2930:17)

To resolve this error, you need polyfill.

Add the below code.

<script src="//cdn.polyfill.io/v2/polyfill.min.js?features=default,MutationObserver"></script>

And it will work.

P.S.

  1. This problem was fixed. It works on v1.0.20.
  2. If polyfill did not work, use this polyfil from mozilla.org(thanks brennaveen!)
  3. v1.0.19 looks unstable

Leave a Comment