Meteor-Community-Packages / ground-db

GroundDB is a thin layer providing Meteor offline database and methods
https://atmospherejs.com/ground/db
MIT License
569 stars 76 forks source link

How to use Ground DB in angular-meteor #149

Open niketaB opened 8 years ago

niketaB commented 8 years ago

I need some guidelines to integrate ground DB with Angular-ionic type of application. What exactly, i am doing is,

  1. I have ionic-angular application
  2. I am using angular-meteor package in to Ionic application, to get meteor packages and functionality. Now I want to use GroundDB, which is meteor package in to my App. Is the ground db package available with angular-meteor package ? Please let us know how to integrate this and use it.
lucnat commented 8 years ago

Hi! I am using ground:db with in an angular ionic app as well, and it works perfectly. Where exactly are you having problems? There is nothing special to say about using ground:db with angular/ionic. Just do everything as usual, that is, define your grounded collections in the lib folder.

zaik18 commented 8 years ago

I need help...

Messages = new Mongo.Collection('messages');

Messages.attachSchema( new SimpleSchema({ text : { type: String },
user_type : { type : String}, chat_session_id : { type : String }, type : { type : String }, lat : { type : String , optional : true}, lng : { type : String , optional : true}, date : { type : String }, is_sent : { type : Boolean , optional : true}, user_id : { type : String }, created_at : { type: Date, autoValue: function() { if (this.isInsert) { return new Date(); } else if (this.isUpsert) { return {$setOnInsert: new Date()}; } else { this.unset(); // Prevent user from supplying their own value } } }, updated_at : { type: Date, autoValue: function() { if (this.isUpdate) { return new Date(); } }, denyInsert: true, optional: true } }) );

if ( Meteor.isClient ) { Ground.methodResume([ 'message.add', 'message.update', 'message.remove' ]); }

if (Meteor.isCordova) { Ground.Collection(Messages); }

I am only getting messages added in offline mode. I want to get all messages wehther added offline or online when page opens.

I am subscribing like this... this.subscribe('Messages'); this.helpers({ messages: () => { return Messages.find({ chat_session_id : vm.chat_data.chat_session_id }).fetch(); } });

please help me out

I am using angular meteor ionic...

koradeharshad commented 7 years ago

@LucNaterop how did you installed GroundDB in ionic