Showing posts with label js-data-angular. Show all posts
Showing posts with label js-data-angular. Show all posts
js-data-angular

js-data-angular

June 21, 2017
Angular wrapper for js-data http://www.js-data.io/docs/js-data-angular What happened Angular-data? Angular-data is deprecated. js-data + js-data-angular is the new hotness. Guides Js-data-angular API Documentation

Quick Start

 bower install --save js-data js-data-angular  
or
 npm install --save js-data js-data-angular  
Load js-data-angular.js after js-data.js
 angular.module('myApp', ['js-data']);  
 angular.module('myApp').factory('Post', function (DS) {  
  return DS.defineResource('post');  
 });  
 angular.module('myApp').factory('Comment', function (DS) {  
  return DS.defineResource('comment');  
 });  
 app.controller('postCtrl', function ($scope, $routeParams, Post, Comment) {  
  // it's up to your server to know how to interpret this query  
  // or you can teach js-data how to understand your servers' query language  
  var query = {  
   postId: $routeParams.id  
  };  
  Post.find($routeParams.id);  
  Comment.findAll(query);  
  // My goodness this was easy  
  Post.bindOne($routeParams.id, $scope, 'post');  
  Comment.bindAll(query, $scope, 'comments');  
  // Long form (same effect as above)  
  $scope.$watch(function () {  
   return Post.lastModified($routeParams.id);  
  }, function () {  
   $scope.post = Post.get($routeParams.id);  
  });  
  $scope.$watch(function () {  
   // Changes when anything in the Comment collection is modified  
   return Comment.lastModified();  
  }, function () {  
   $scope.comments = Comment.filter(query);  
  });  
 });  

Community

  • Slack Room - Better than IRC!
  • Announcements
  • Mailing List - Ask your questions!
  • Issues - Found a bug? Feature request? Submit an issue!
  • GitHub - View the source code for js-data.
  • Contributing Guide

Contributing

First, support is handled via the Gitter Channel and the Mailing List. Ask your questions there.

When submitting issues on GitHub, please include as much detail as possible to make debugging quick and easy.
  • good - Your versions of Angular, js-data, js-data-angular, etc., relevant console logs/error, code examples that revealed the issue
  • better - A plnkr, fiddle, or bin that demonstrates the issue
  • best - A Pull Request that fixes the issue, including test coverage for the issue and the fix
Github Issues License The MIT License (MIT)

Note: Special thanks to js-data

Contact - jsdata@groups.io

Disclaimer: The blog is created to share angular directives information to geek, curious Angular Developers.