Cordova-Examples
Cordova-Examples copied to clipboard
ReferenceError: cordova is not defined in
Hi, Thank you for your code sharing but I got falowing error for : Cordova-Examples/securestorage_ionicnative/app/pages/home/home.ts in run time ReferenceError: cordova is not defined
at securestorage.js:57
at new t (polyfills.js:3)
at SecureStorage.create (securestorage.js:56)
at home.ts:28
at t.invoke (polyfills.js:3)
at Object.onInvoke (ng_zone.js:236)
at t.invoke (polyfills.js:3)
at e.run (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
and fallowing for data input and login button click:
Object {success: 0}
plugin.js:33 Native: tried calling Dialogs.alert, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator
cordovaWarn @ plugin.js:33
callCordovaPlugin @ plugin.js:112
(anonymous) @ plugin.js:160
(anonymous) @ plugin.js:132
t @ polyfills.js:3
tryNativePromise @ plugin.js:131
getPromise @ plugin.js:153
wrapPromise @ plugin.js:159
(anonymous) @ plugin.js:326
value @ plugin.js:387
(anonymous) @ home.ts:79
SafeSubscriber.__tryOrSetError @ Subscriber.js:232
SafeSubscriber.next @ Subscriber.js:174
Subscriber._next @ Subscriber.js:125
Subscriber.next @ Subscriber.js:89
ArrayObservable._subscribe @ ArrayObservable.js:114
Observable.subscribe @ Observable.js:56
HomePage.login @ home.ts:58
View_HomePage0.handleEvent_35 @ component.ngfactory.js:507
(anonymous) @ view.js:408
(anonymous) @ dom_renderer.js:276
t.invokeTask @ polyfills.js:3
onInvokeTask @ ng_zone.js:227
t.invokeTask @ polyfills.js:3
e.runTask @ polyfills.js:3
invoke @ polyfills.js:3
error_handler.js:47 EXCEPTION: Uncaught (in promise): TypeError: Cannot read property 'remove' of undefined
TypeError: Cannot read property 'remove' of undefined
at callInstance (http://localhost:8100/build/main.js:542:37)
at http://localhost:8100/build/main.js:580:17
at http://localhost:8100/build/main.js:466:17
at new t (http://localhost:8100/build/polyfills.js:3:11329)
at tryNativePromise (http://localhost:8100/build/main.js:465:20)
at getPromise (http://localhost:8100/build/main.js:487:16)
at SecureStorage.<anonymous> (http://localhost:8100/build/main.js:579:20)
at SecureStorage.value [as remove] (http://localhost:8100/build/main.js:740:61)
at SafeSubscriber._next (http://localhost:8100/build/main.js:55171:37)
at SafeSubscriber.__tryOrSetError (http://localhost:8100/build/main.js:1284:16)
ErrorHandler.handleError @ error_handler.js:47
IonicErrorHandler.handleError @ ionic-error-handler.js:56
next @ application_ref.js:272
schedulerFn @ async.js:82
SafeSubscriber.__tryOrUnsub @ Subscriber.js:223
SafeSubscriber.next @ Subscriber.js:172
Subscriber._next @ Subscriber.js:125
Subscriber.next @ Subscriber.js:89
Subject.next @ Subject.js:55
EventEmitter.emit @ async.js:74
NgZone.triggerError @ ng_zone.js:278
onHandleError @ ng_zone.js:257
t.handleError @ polyfills.js:3
e.runGuarded @ polyfills.js:3
r @ polyfills.js:3
i @ polyfills.js:3
invoke @ polyfills.js:3
error_handler.js:52 ORIGINAL STACKTRACE:
ErrorHandler.handleError @ error_handler.js:52
IonicErrorHandler.handleError @ ionic-error-handler.js:56
next @ application_ref.js:272
schedulerFn @ async.js:82
SafeSubscriber.__tryOrUnsub @ Subscriber.js:223
SafeSubscriber.next @ Subscriber.js:172
Subscriber._next @ Subscriber.js:125
Subscriber.next @ Subscriber.js:89
Subject.next @ Subject.js:55
EventEmitter.emit @ async.js:74
NgZone.triggerError @ ng_zone.js:278
onHandleError @ ng_zone.js:257
t.handleError @ polyfills.js:3
e.runGuarded @ polyfills.js:3
r @ polyfills.js:3
i @ polyfills.js:3
invoke @ polyfills.js:3
error_handler.js:53 Error: Uncaught (in promise): TypeError: Cannot read property 'remove' of undefined
TypeError: Cannot read property 'remove' of undefined
at callInstance (plugin.js:208)
at plugin.js:246
at plugin.js:132
at new t (polyfills.js:3)
at tryNativePromise (plugin.js:131)
at getPromise (plugin.js:153)
at SecureStorage.<anonymous> (plugin.js:245)
at SecureStorage.value [as remove] (plugin.js:406)
at SafeSubscriber._next (home.ts:80)
at SafeSubscriber.__tryOrSetError (Subscriber.js:232)
at s (polyfills.js:3)
at new t (polyfills.js:3)
at tryNativePromise (plugin.js:131)
at getPromise (plugin.js:153)
at SecureStorage.<anonymous> (plugin.js:245)
at SecureStorage.value [as remove] (plugin.js:406)
at SafeSubscriber._next (home.ts:80)
at SafeSubscriber.__tryOrSetError (Subscriber.js:232)
at SafeSubscriber.next (Subscriber.js:174)
at Subscriber._next (Subscriber.js:125)
how ever it return 0 for login but it is not going to main-page also I am using the fallowings:
Ionic Framework: 2.0.0-rc.4
Ionic Native: 2.2.11
Ionic App Scripts: 0.0.47
Angular Core: 2.2.1
Angular Compiler CLI: 2.2.1
Node: 6.9.1
OS Platform: Windows 10
Navigator Platform: Win32
User Agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Mobile Safari/537.36
Are you running it in a Cordova project?
Hi, yes as I mentioned: i am using ionic 2.0.0.rc4 with cordova 6.X.
And you copied my code into the src folder? And you are running it via ionic server or ionic emulate?
yes i copied and using ionic serve command
Oh, I think this one may only work on a device/emulator - can you try there please.
sure I will do and let you know.
I have tested, Icouldn't run application on android SDK emulator it shows a black screen and could not open Index.html from www/asset/index.html. Andy Android Emulator 46.16.48 open's application gets user and password but login button is not working I've also add ng-enter controller but didn't navigate to main-page.
So when running in the emulator (or device), use remote debug to see if you can flesh out an error.
in my case it gives error as build if failed, however my problem is the same as above
Which part though?
this part is fixed already, I had to add cordova.js in my html file.