cordova-data

angularjs directives that extract data from the device into your scopes


Keywords
cordova, cordova-plugins, angularjs
License
MIT
Install
bower install cordova-data

Documentation

cordova-data

angularjs directives that extract data from the device into your scopes.

Introduction

The motivation behind this library is to create a declarative way of obtaining data from devices in angularjs cordova projects.

Examples:

Device Information

In order to obtain the device information you probably need to write the following code:

<div ng-controller="deviceController">
Device model: {{device.model}}
</div>
myApp.controller('deviceController', ['$scope', '$window', '$document', function($scope, $window, $document) {
  $document[0].addEventListener("deviceready", function() {
    $scope.device = $window.device;
  }, false);
}]);

With cordova-data, the following code achieve the same goal:

<div cordova-device>
Device model: {{device.model}}
</div>

As you can see, the cordova-device directive adds the device information to the corresponding scope. No javascript required.