陈斌彬的技术博客

Stay foolish,stay hungry

ngCordova-demo

img

img

img

img

img

img

img

img

dialogs

.controller('DashCtrl', function($scope, $cordovaDialogs) {

   $cordovaDialogs.alert('message', 'title', 'button name')
    .then(function() {
      // callback success
    });

  $cordovaDialogs.confirm('message', 'title', ['button 1','button 2'])
    .then(function(buttonIndex) {
      // no button = 0, 'OK' = 1, 'Cancel' = 2
      var btnIndex = buttonIndex;
    });

  $cordovaDialogs.prompt('msg', 'title', ['btn 1','btn 2'], 'default text')
    .then(function(result) {
      var input = result.input1;
      // no button = 0, 'OK' = 1, 'Cancel' = 2
      var btnIndex = result.buttonIndex;
    });

  // beep 3 times
  $cordovaDialogs.beep(3);

})

actionsheet

  .controller('DashCtrl', function($ionicPlatform, $scope, $cordovaActionSheet) {
    $ionicPlatform.ready(function() {

      var options = {
        title: '你要做什么?',
        buttonLabels: ['分享到陈斌彬的技术博客', '分享到朋友圈'],
        addCancelButtonWithLabel: '取消',
        androidEnableCancelButton: true,
        winphoneEnableCancelButton: true,
        addDestructiveButtonWithLabel: '删除这个'
      };

      $scope.showToast = function() {

        // $cordovaToast.show(uuid, 'long', 'center');
        $cordovaActionSheet.show(options)
            .then(function(btnIndex) {
              var index = btnIndex;
            });
     }


 });

})

toast

  .controller('DashCtrl', function($ionicPlatform, $scope, $cordovaToast) {
    $ionicPlatform.ready(function() {
      $cordovaToast.showShortTop('Hello World!!');

      $scope.showToast = function() {
        $cordovaToast
            .show('You clicked a button!!', 'long', 'center');
      }
    });
  })