Has anyone run into issues on Safari?


#1

Hello,

We are getting an error only on safari (iOS) where the injector is failing when I try to go to my page for the first time. chrome, FF, and Opera are fine.

Please see below:

TypeError: undefined is not an object (evaluating 'injector.getOptional')
_runAppInitializersapplication_ref.ts:288
_initAppapplication_ref.ts:269
applicationapplication_ref.ts:213
bootstrapbrowser.ts:110
(anonymous function)app.js:63
DecorateConstructorangular2-polyfills.js:2064
decorateangular2-polyfills.js:1626
(anonymous function)_prelude.js:1
(anonymous function)app.ts:148
(anonymous function)app.ts:81
s_prelude.js:1
e_prelude.js:1
(anonymous function)_prelude.js:1

I also removed the ‘use strict’ statement during the gulp build process. I suspect something isn’t injected correctly, but I’m not sure.

My dependencies:

“angular2”: “2.0.0-beta.15”,
“es6-promise”: “3.1.2”,
“es6-shim”: “^0.35.0”,
“ionic-angular”: “2.0.0-beta.6”,
“ionic-native”: “^1.1.1”,
“ionicons”: “^3.0.0”,
“lodash”: “^4.11.0”,
“reflect-metadata”: “0.1.2”,
“rxjs”: “5.0.0-beta.6”,
“zone.js”: “^0.6.12”

Running ionic info yields:

Cordova CLI: 6.1.1
Gulp version:  CLI version 3.8.11
Gulp local:   Local version 3.9.1
Ionic Framework Version: 2.0.0-beta.6
Ionic CLI Version: 2.0.0-beta.25
Ionic App Lib Version: 2.0.0-beta.15
OS: Distributor ID:	Ubuntu Description:	Ubuntu 14.04.4 LTS 
Node Version: v5.10.1

Any help is greatly appreciated!

Thanks,

Denis


#2

Could you share a way to recreate this issue?
Not sure where this is coming from.


#3

Hi Mike,

I solved the issue. After stripping out 99% of my code and rebuilding from scratch, I found several things that may have contributed to my problem. I added an inclusion to the es6-shim.js file from index.html (before the polyfill.js inclusion), I made a change to the gulp build process to remove the ‘use strict’ statement. I also made sure all components had an @injectable decorator. Finally, I removed the provide entry (provide(Window, {useValue: window})) for the browser window from the @App providers list and not inject Window into components. I have to reference it as a global variable and assume it’ll always be there. Not ideal, I would prefer to inject the window object somehow, but not sure what the best way is yet.

Thanks for following up!

Denis