SHARE
TWEET

Untitled

a guest Jan 11th, 2016 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .controller('MainController', ['$scope', 'nfcService', function($scope, nfcService) {
  2.     $scope.card = nfcService.uid;
  3. }])
  4. .factory('nfcService', function($rootScope, $ionicPlatform) {
  5.     var uid = {};
  6.  
  7.     $ionicPlatform.ready(function() {
  8.         nfc.addTagDiscoveredListener(function (nfcEvent) {
  9.             var tag = nfcEvent.tag;
  10.             var tagId = nfc.bytesToHexString(tag.id);
  11.             $rootScope.$apply(function() {
  12.                 angular.copy(tagId, uid);
  13.             });
  14.         }, function () {
  15.             //....
  16.         }, function (reason) {
  17.             //...
  18.         });
  19.   });
  20.     return {
  21.         uid: uid,
  22.     };
  23.  
  24. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top