• $cordovaDialogs使用时遇到的问题


    1:按照http://ngcordova.com/docs/plugins/dialogs/文档介绍进行安装使用:

     //标题栏
    .controller('TitleCtrl', function($scope,$cordovaDialogs,$ionicHistory){
         $scope.wzhGoBack = function(){
               $ionicHistory.goBack();
         };
    
         $scope.wzhCloseApp = function(){
             $cordovaDialogs.confirm('您确定要退出系统?', '友情提示', ['确定','取消'])
                 .then(function(buttonIndex) {
                     // no button = 0, 'OK' = 1, 'Cancel' = 2
                     if (buttonIndex == 1) {
                         ionic.Platform.exitApp();
                     }
                 });
             $cordovaDialogs.beep(3);
         };
    })

    运行在手机上只显示了标题栏,下面的界面没有了,通过运行ionic serve在网页上报错信息如下:

    ionic.bundle.js:21157 Error: [$injector:unpr] Unknown provider: $cordovaDialogsProvider <- $cordovaDialogs <- TitleCtrl
    http://errors.angularjs.org/1.4.3/$injector/unpr?p0=%24cordovaDialogsProvider%20%3C-%20%24cordovaDialogs%20%3C-%20TitleCtrl
        at ionic.bundle.js:8895
        at ionic.bundle.js:13089
        at Object.getService [as get] (ionic.bundle.js:13236)
        at ionic.bundle.js:13094
        at getService (ionic.bundle.js:13236)
        at Object.invoke (ionic.bundle.js:13268)
        at extend.instance (ionic.bundle.js:17826)
        at nodeLinkFn (ionic.bundle.js:16936)
        at compositeLinkFn (ionic.bundle.js:16368)
        at nodeLinkFn (ionic.bundle.js:16972)

    2:需要安装ngCordova

    参照:http://ngcordova.com/docs/install/

    (1)index.html

        <script src="lib/ngCordova/dist/ng-cordova.min.js"></script>
        <script src="cordova.js"></script>

    (2)app.js

    angular.module('starter',
        [
          'ionic',
          'starter.controllers',
          'starter.services',
          'ngCordova'
        ]
    )
  • 相关阅读:
    Java--动态代理
    java-finalize
    Oauth1.0认证过程
    深入理解-HashMap
    Java--对象内存布局
    Java--finally
    一个非常有用的算法---统计二进制数中1的个数
    进程之间通信
    SpringMVC听课笔记(十三:使用拦截器)
    SpringMVC听课笔记(十二:文件的上传)
  • 原文地址:https://www.cnblogs.com/yshyee/p/4735107.html
Copyright © 2020-2023  润新知