Is it working on Ionic? Mine is not
Is this live-set module working on ionic? because mine is not working. and i don't get any error.
here is my code:
on Main App
angular.module('starter', ['ionic', 'starter.controllers', 'lbServices', 'ls.LiveSet', 'ls.ChangeStream'])
//etc............
on Controller
angular.module('starter.controllers', [])
.controller('ProductsCtrl', function($scope, $ionicModal, Product, createChangeStream, LiveSet) {
var src = new EventSource('http://localhost:3000/api/products/change-stream?_format=event-source');
var changes = createChangeStream(src);
var set;
Product.find().$promise.then(function(results) {
set = new LiveSet(results, changes);
$scope.products = set.toLiveArray();
});
changes.on('data', function(update) {
// add the new data to the chart
console.log('something happened')
console.log(update)
});
//etc.................
My data is shown like expected, but the realtime thing is not working. Please help
I have a similar problem, not with Ionic but with the module in general. I copied the example in the demo in my project, but I am unable to receive any update in the Controller.
There seems to be a problem with compression in the middleware (express)
check your middleware.json file in the server dir.
remove: ""compression": {},"
I thought a fix had been pushed or the README updated.
On Tue, Sep 29, 2015 at 3:06 AM, pasine [email protected] wrote:
I have a similar problem, not with Ionic but with the module in general. I copied the example in the demo in my project, but I am unable to receive any update in the Controller.
— Reply to this email directly or view it on GitHub https://github.com/strongloop/angular-live-set/issues/12#issuecomment-144013473 .
StrongLoop http://strongloop.com/* makes it easy to develop APIs http://strongloop.com/mobile-application-development/loopback/ in Node, plus get DevOps capabilities http://strongloop.com/node-js-performance/strongops/ like monitoring, debugging and clustering*.
My bad for not reading the Readme carefully. Thanks @seanbrookes , it WORKS!
but this part is not working
Product.find().$promise.then(function(results) {
set = new LiveSet(results, changes);
$scope.products = set.toLiveArray();
});
and this part work, so I only able to manually push it to array using "changes"
changes.on('data', function(update) {
$scope.products.push(update.data);
});
Did u know why?
Can you provide a sample repo to reproduce this issue?
Same issue for me ... I'm able to liste the change events but .toLiveArray method doesn't seem to update my array !
I just make it works by replacing some lines in live-set.js -> Replace from line 4334 by this following
changes.on('data', function(change) { if(change) { set._applyChange(change); } });
Closing this issue due to inactivity.