2015-11-13 103 views
1

我試圖使用從科爾多瓦打印機插件:https://github.com/katzer/cordova-plugin-printer/tree/master離子科爾多瓦打印機錯誤

我按照安裝說明和index.html中有這樣的:

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

這裏是我的電話控制器:

$scope.printTable = function(){ 
    $ionicPlatform.ready(function() { 
    cordova.plugins.printer.isAvailable(
     function (isAvailable) { 
      alert(isAvailable ? 'Service is available' : 'Service NOT available'); 
     }); 
    }) 
    }; 

我得到的PhoneGap應用此錯誤:

Error: undefined is not an object (evaluating 'cordova.plugins.printer') 

我有這個加在我的config.xml文件:

<gap:plugin name="de.appplant.cordova.plugin.printer" version="0.7.0" /> 

我在這裏失蹤

回答

0
$scope.print = function() { 
    if ($cordovaPrinter.isAvailable()) { 
     $cordovaPrinter.print(//type what to display); 
    } else { 
     alert("Printing is not available on device"); 
    } 
} 

什麼只是嘗試這樣