Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
angular-ddp.js

README.md

Angular DDP Client

How to use

Include the script in your HTML:

<script src="path_to_file/angular-ddp.js"></script>

Then connect:

angular.module('starter.controllers', ['angularDDP'])

.controller('SampleCtrl', function($scope, $timeout, DDP) {

  var ddp = new DDP('ws://localhost:3000/websocket');
  var ddpconnect = ddp.connect();

  ddpconnect.then(function() {
    ddp.subscribe('api_products_latest', [0,5])
      .then(function() {
        $timeout(function () {
          $scope.products = ddp.getCollection('products');
          console.log($scope.products);
        });
      });
    ddp.watch('products', function(changedDoc, message) {
      // Something
    });
  });

});

If using Ionic Framework, load the module in your app.js file.

angular.module('starter', ['ionic', 'starter.controllers', 'starter.services', 'angularDDP'])
You can’t perform that action at this time.