Cordova not defined

I'm trying to use this Parse Plugin in Ionic project. But the device is not registering at all. I can see that window.cordovais undefined at all times.

App.js

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {

    if(window.cordova && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
    }
    if(window.StatusBar) {
      // org.apache.cordova.statusbar required
      StatusBar.styleDefault();
    }

    if(window.cordova){

    }else{
        alert('Cordova Plugin '+window.cordova); //output undefined
    }

    if(window.parsePlugin){

    }else{
        alert("Window.ParsePlugin not defined "+window.parsePlugin) // output undefined
    }

    /*Parse Notifications */
    try{
        parsePlugin.initialize('XXX', 'YYY', function() {
            alert('success');
        }, function(e) {
            alert('error');
        });

    }catch(err){
        alert('Parse Error '+err.message);
        alert('Stack '+err.stack);
    }

  });
})

The same piece of code works in a demo project. I modified the demo project and made changes to the app.js and controller.js then code stops working.

Can anyone please suggest some debugging tips?

Thanks