ionic-team / ng-cordova

OBSOLETE: Please move to Ionic Native https://github.com/ionic-team/ionic-native
https://github.com/ionic-team/ionic-native
MIT License
3.48k stars 1.05k forks source link

ReferenceError: cordova is not defined #1260

Open chiragandroid opened 8 years ago

chiragandroid commented 8 years ago

hello sir, i am using ionic 1.0 and wanted to use email feature in ionic. i followed this.

  1. ngCordova in dependency. angular.module('mrindia', ['ionic','ngValidateModule','ngCordova']);
  2. i had ngCordova in lib folder. <script src="lib/ngValidate.js"></script> in index.html
  3. applied code in ForgetCtrl with parameter .controller('ForgotCntrl', ['$scope','$state','$cordovaEmailComposer','UserStore','$ionicSideMenuDelegate', function($scope,$state,$cordovaEmailComposer,UserStore,$ionicSideMenuDelegate){
  4. now mailing code:

`$cordovaEmailComposer.isAvailable().then(function() { // is available }, function () {

    console.log("Mailing is not available");
   });

  var email = {
    to: $scope.mailObj.mail,
    subject: 'Testing',
    body: 'Testing',
    isHtml: true
  };

  $cordovaEmailComposer.open(email).then(null, function () {
  console.log("Email closed");
  });
};`

i am sure that $scope.mailObj.mail is not null. please help.

Error is coming when trying to run in android with

ionic run -lc android

ihadeed commented 8 years ago

Hey there,

I'm not sure if there are any bugs with ngCordova related to this plugin. But as far as I know, the email plugin is currently broken and the developer hasn't fixed it yet.