angular-live-set icon indicating copy to clipboard operation
angular-live-set copied to clipboard

Is it working on Ionic? Mine is not

Open radiegtya opened this issue 11 years ago • 7 comments

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

radiegtya avatar Sep 29 '15 02:09 radiegtya

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.

pasine avatar Sep 29 '15 10:09 pasine

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*.

seanbrookes avatar Sep 29 '15 15:09 seanbrookes

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?

radiegtya avatar Sep 30 '15 02:09 radiegtya

Can you provide a sample repo to reproduce this issue?

0candy avatar Jan 14 '16 21:01 0candy

Same issue for me ... I'm able to liste the change events but .toLiveArray method doesn't seem to update my array !

pierreclr avatar Jul 11 '16 16:07 pierreclr

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); } });

pierreclr avatar Jul 11 '16 17:07 pierreclr

Closing this issue due to inactivity.

dhmlau avatar Jun 13 '18 02:06 dhmlau