1
Answer

not showing printing option

i have created an app using ionic to print a page but its not showing printing option
 
here is my Index code
  1. <!DOCTYPE html>  
  2. <html>  
  3.   
  4. <head>  
  5.     <meta charset="utf-8">  
  6.     <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">  
  7.     <title></title>  
  8.   
  9.     <link rel="manifest" href="manifest.json">  
  10.     <link href="lib/ionic/css/ionic.css" rel="stylesheet">  
  11.     <link href="css/style.css" rel="stylesheet">  
  12.     <!-- ionic/angularjs js -->  
  13.     <script src="lib/ionic/js/ionic.bundle.js"></script>  
  14.   
  15.     <!-- cordova script (this will be a 404 during development) -->  
  16.     <script src="js/ng-cordova.min.js"></script>  
  17.     <script src="cordova.js"></script>  
  18.   
  19.     <!-- your app's js -->  
  20.     <script src="js/app.js"></script>  
  21. </head>  
  22.   
  23. <body ng-app="starter">  
  24.     <ion-pane>  
  25.         <ion-header-bar class="bar-stable">  
  26.             <h1 class="title">Print</h1>  
  27.         </ion-header-bar>  
  28.         <br>  
  29.         <br>  
  30.         <ion-content ng-controller="ExampleController">  
  31.             <button class="button" ng-click="print()">Print Webpage</button>  
  32.         </ion-content>  
  33.     </ion-pane>  
  34. </body>  
  35.   
  36. </html>  
and app.js is
  1. var a = angular.module('starter', ['ionic''ngCordova']);  
  2.   
  3. a.run(function($ionicPlatform) {  
  4.     $ionicPlatform.ready(function() {  
  5.         if (window.cordova && window.cordova.plugins.Keyboard) {  
  6.   
  7.             cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);  
  8.   
  9.   
  10.             cordova.plugins.Keyboard.disableScroll(true);  
  11.         }  
  12.         if (window.StatusBar) {  
  13.             StatusBar.styleDefault();  
  14.         }  
  15.     });  
  16. });  
  17. a.controller("ExampleController"function($scope, $cordovaPrinter) {  
  18.   
  19.     $scope.print = function() {  
  20.         if ($cordovaPrinter.isAvailable()) {  
  21.             $cordovaPrinter.print("https://www.nraboy.com");  
  22.         } else {  
  23.             alert("Printing is not available on device");  
  24.         }  
  25.     }  
  26. });  
am getting these errors
 
 
Error: [$injector:modulerr] Failed to instantiate module ng-cordova due to:
Error: [$injector:nomod] Module 'ng-cordova' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
 
Answers (1)
0
Bikesh Srivastava

Bikesh Srivastava

78 23.9k 3.6m 8y
Hi,
This error means you are not adding your 'ngCordova.js file in your application
so please check again your js file and configuration.