Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
not showing printing option
Edison Augusthy
Sep 15 2016 5:44 AM
328
Reply
i have created an app using ionic to print a page but its not showing printing option
here is my Index code
<!DOCTYPE html>
<html>
<head>
<meta charset=
"utf-8"
>
<meta name=
"viewport"
content=
"initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"
>
<title></title>
<link rel=
"manifest"
href=
"manifest.json"
>
<link href=
"lib/ionic/css/ionic.css"
rel=
"stylesheet"
>
<link href=
"css/style.css"
rel=
"stylesheet"
>
<!-- ionic/angularjs js -->
<script src=
"lib/ionic/js/ionic.bundle.js"
></script>
<!-- cordova script (
this
will be a 404 during development) -->
<script src=
"js/ng-cordova.min.js"
></script>
<script src=
"cordova.js"
></script>
<!-- your app's js -->
<script src=
"js/app.js"
></script>
</head>
<body ng-app=
"starter"
>
<ion-pane>
<ion-header-bar
class
=
"bar-stable"
>
<h1
class
=
"title"
>Print</h1>
</ion-header-bar>
<br>
<br>
<ion-content ng-controller=
"ExampleController"
>
<button
class
=
"button"
ng-click=
"print()"
>Print Webpage</button>
</ion-content>
</ion-pane>
</body>
</html>
and app.js is
var
a = angular.module(
'starter'
, [
'ionic'
,
'ngCordova'
]);
a.run(
function
($ionicPlatform) {
$ionicPlatform.ready(
function
() {
if
(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(
true
);
cordova.plugins.Keyboard.disableScroll(
true
);
}
if
(window.StatusBar) {
StatusBar.styleDefault();
}
});
});
a.controller(
"ExampleController"
,
function
($scope, $cordovaPrinter) {
$scope.print =
function
() {
if
($cordovaPrinter.isAvailable()) {
$cordovaPrinter.print(
"https://www.nraboy.com"
);
}
else
{
alert(
"Printing is not available on device"
);
}
}
});
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.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
New tab in angular js report.
Angularjs html5Mode page refresh breaks the routing in asp