Ionic1 sms is not defined


#1

i’m used cordova-plugin-sms
ionic.bundle.js:26799 ReferenceError: sms is not defined
at Object.send (ng-cordova.js:6641)
at ChildScope.$scope.sendSMS (login.js:47)
at fn (eval at compile (ionic.bundle.js:27643), :4:212)
at ionic.bundle.js:65429
at ChildScope.$eval (ionic.bundle.js:30400)
at ChildScope.$apply (ionic.bundle.js:30500)
at HTMLButtonElement. (ionic.bundle.js:65428)
at defaultHandlerWrapper (ionic.bundle.js:16792)
at HTMLButtonElement.eventHandler (ionic.bundle.js:16780)
at triggerMouseEvent (ionic.bundle.js:2953)

  • SOURCE
    .controller(‘SMSController’, function($scope, $ionicPlatform, $cordovaSms) {

    var options = {
    replaceLineBreaks: false, // true to replace \n by a new line, false by default
    android: {
    intent: ‘’ // send SMS with the native android SMS messaging
    //intent: ‘’ // send SMS without open any other app
    //intent: ‘INTENT’ // send SMS inside a default SMS app
    }
    };
    $scope.sendSMS = function() {
    $cordovaSms.send(‘070101199’, ‘oo’, options).then(function() {
    alert(‘Success’);
    // Success! SMS was sent
    }, function(error) {
    alert(‘Error’);
    // An error occurred
    });
    }
    });


#2

This exists and should help:
http://ngcordova.com/docs/plugins/sms/