How to call $cordovaDialogs on click

I’m using the tabs template, trying to get ng-click on a button to show a ngCordova dialog. I’ve got the plugin installed and working when the controller fires. The button calls my $scope.alert(), but the $cordovadialogs.alert(“wow2!”); is not called because $cordovadialogs is undefined. Why does $scope not know about $cordovadialogs? I’m new to Angular… should this function be defined differently?

Code is as follows:

.controller('FriendDetailCtrl', function ($scope, $stateParams, Friends, $cordovaDialogs) {
    $scope.friend = Friends.get($stateParams.friendId);

    $scope.alert = function () {
        $cordovadialogs.alert("wow2!");//NOT WORKING

Are you sure the plugin is included? Where are you trying to run this code - in the browser or on the device?

Yep plugin is working in controller. Running on device.

And if you remove the alert call inside alert function whats happens?

$cordovadialogs is not the same as $cordovaDialogs

That did it! Thank you sir! I should have known that.

rafaellop: removing the js alert() had no effect.

I’ve thought that there’s a mess with the same names of three different alert() calls. Haven’t noticed the misspelling. Congrats to craigj :slight_smile: