0
gap_init:2 
gap:[null,"CoreAndroid","messageChannel","CoreAndroid1594682113"] 
gap:[null,"CoreAndroid","show","CoreAndroid1594682114"]

I am trying to develop Cordova app with angular js 2.0 I have created Cordova hello world and angular js 2.0 hello world then I have merged both the things

But while running the app these popups are generated and then nothing happens

Sid Mhatre
  • 3,272
  • 1
  • 19
  • 38
Janki Sata
  • 51
  • 7

1 Answers1

1

You make project using angular-cli, You make one cordova project Then in your angular-cli.json file -> change the path to cordova's www folder.

Then when you do ng prod build, your resources would be copied to cordova's www folder.

I wrote one cordova hook for the same,

const fs = require('fs');
const execSync = require('child_process').execSync;



module.exports = function(context) {
    const basePath = context.opts.projectRoot;
    const baseWWW = basePath + '/www';

process.chdir('../bmi-surgical-app');
console.log(`New directory: ${process.cwd()}`);

    execSync("ng build --prod --base-href .",{stdio:[0,1,2]});

    var files = fs.readdirSync(baseWWW);
    for (var i = 0; i < files.length; i++) {
      if (files[i].endsWith('.gz')) {
        fs.unlinkSync(baseWWW + '/' + files[i]);
      }
    }
    fs.writeFileSync(baseWWW + '/.gitignore', `# Ignore everything in this directory

*
# Except this file
!.gitignore
`);


};

However many better options are available like NativeScript & Ionic 2.

Parth Ghiya
  • 6,929
  • 2
  • 30
  • 37
  • Actually, I am new to PhoneGap or Cordova so I don't know what is the use of hook and how can I use it as we tried for beta angular 2.0 with ios and it's working perfectly. so we need to do same as IOS – Janki Sata Feb 16 '17 at 08:54
  • hook is something which u want to execute before cordova build or cordova run command. The above hook does the following purpose Generated minified, transpiled files in the www folder. ignores the compressed gz files of Angular CLI. – Parth Ghiya Feb 16 '17 at 08:56