Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular Cordova app goes blank when cordova.js is included

I am creating an Angular + Cordova application and it works great in the browser.

The issue what I am facing is that when I try to include cordova.js file, the app goes blank when loaded on a device. I have done some research and it turns out to be something with cordova.exec and zone.js used in Angular causing the issue.

I would like a solution on how to properly include cordova.js in an Angular based project.

Cordova

android 8.0.0
ios 5.0.1

Angular

@angular-devkit/architect         0.801.1
@angular-devkit/build-angular     0.801.1
@angular-devkit/build-optimizer   0.801.1
@angular-devkit/build-webpack     0.801.1
@angular-devkit/core              8.1.1
@angular-devkit/schematics        8.1.1
@ngtools/webpack                  8.1.1
@schematics/angular               8.1.1
@schematics/update                0.801.1
rxjs                              6.4.0
typescript                        3.4.5
webpack                           4.35.2
like image 725
Nidhin Joseph Avatar asked Jul 18 '19 04:07

Nidhin Joseph


1 Answers

Try these: This youtube video says we need to change the <base href="/"> in your index.html to <base href="./">. If that doesn't work, try changing your type="module" to type="text/javascript" in your index.html.

like image 59
Philip Avatar answered Nov 08 '22 19:11

Philip