1.0.34 • Published 5 years ago

pk-pass-display v1.0.34

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

#PassKit Pass Display

NPM version Bower version

##Usage

Include in your index file:

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" type="text/css" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="node_modules/pk-pass-display/dist/pk-pass-display.min.css">
</head>
<body>
    <div data-ng-app="myApp" data-ng-controller="passCtrl">
        <pk-apple-pass pass-id="{{passId}}"></pk-apple-pass>
    </div>
    <script src="node_modules/angular/angular.min.js"></script>
    <script src="node_modules/moment/min/moment-with-locales.min.js"></script>
    <script src="node_modules/pk-pass-display/dist/pk-pass-display.min.js"></script>
    <script>
        (function (angular) {
            angular.module("myApp", ["pk-pass-display"])
            .config(["$locationProvider", function($locationProvider) {
                $locationProvider.html5Mode({enabled:true,requireBase:false});
            }])
            .controller("passCtrl", ["$scope", "$location", passController]);

            function passController($scope, $location) {
                $scope.passId = $location.search().pid;
            }
        })(window.angular);
    </script>
</body>
</html>

Use as component (see index.html for example):

<pk-apple-pass pass-id="passId"></pk-apple-pass>

Optional attributes are:

language="en" // can be any language code available on your pass
bg-color="blue" // can be any css color
on-error="errorHandler(err)" // function to handle error callback
on-loaded="loadedHandler(pass)" // function to handle loaded callback

###Note on the callback functions:

For angular components, the variable name in the view must match the name in the component. So pass and err must keep that name within the view. on-loaded passes back the pass object when loading is complete, on-error passes back an error string if there was an error loading the pass.

Example error handling:

<pk-apple-pass pass-id="{{passId}}" on-error="errorHandler(err)"></pk-apple-pass>
.
.
.
function passController($scope, $location) {
    $scope.passId = $location.search().pid;
    $scope.errorHandler = function(errorMessage) {
        alert(errorMessage);
    }
}

##Development

(Requires Node.js https://nodejs.org).
Make sure npm is up to date (comes with Node.js).
Run npm i

###Modifying

To have dist update while you modify the files:
Run gulp watch /dist will be updated whenever you save changes.

###Deploying

Modify files as required.
Run gulp "/dist" will now contain updated files and package version can be updated.

1.0.34

5 years ago

1.0.33

5 years ago

1.0.32

5 years ago

1.0.31

5 years ago

1.0.30

5 years ago

1.0.29

5 years ago

1.0.28

5 years ago

1.0.27

5 years ago

1.0.26

5 years ago

1.0.25

5 years ago

1.0.24

5 years ago

1.0.22

5 years ago

1.0.21

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.16

5 years ago

1.0.15

7 years ago

1.0.14

7 years ago

1.0.13

7 years ago

1.0.12

8 years ago

1.0.11

8 years ago

1.0.10

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago