How to use groundDb package in Ionic + angular application? - angularjs

I have an ionic + angular application and we have used Meteor DDP at server, at present we have created client side collection in minimongo database which is created in clientside memory. which gets clear when user removes application from memory.
I want support offline feature & persistent storage on client-side, so when application goes to offline mode it should display data from local database.
I found GroundDB suits better in my project but the challenge is there no out of box GroundDB package to include in ionic project.
Do anyone have used GroundDB in ionic + angular project? if yes please share steps to include GroundDB.
I also know that Meteoric is the solution for this but I dont want to use Meteor for frontend, I want to use AngularJS.

Related

is it possible to create a PWA in angularjs?

I am new to PWA, i am curious to know that is it possible to create a PWA in angularjs?
please provide steps to make PWA using angularjs if it is possible to create PWA using angularjs.
There's nothing framework-specific about PWAs - your site just has to meet a certain set of criteria:
Everything is served over HTTPS
The design must be responsive
Your app must be available offline (i.e. it needs a Service Worker)
You need to provide a manifest file containing metadata about your application
Your app must work in all modern browsers
Page transitions shouldn't block the app (i.e. you need to show loading screens/spinners if things are taking a while to load)
Each page in the app needs a unique URL
All of that is achievable with Angular 1 - it'll probably be easier with a modern framework, but there's nothing stopping you sticking with what you've got, for now at least.
look at this github project https://github.com/addyosmani/angular1-dribbble-pwa

Grails - Ionic - AngularJS - Is it a good idea to work in this Env.?

I want to create an application using Ionic and AngularJS and Grails?
Also, I want to use Grails Spring Security Core plugin for login or registrations procedure.
Although, Stack Overflow is not the correct site to ask this type of questions which simply needs suggestions and other's opinions.
Well, we are here to help. You can try other StackExchange sites like https://softwareengineering.stackexchange.com/.
Grails + Ionic + AngularJS is a perfect combination of frameworks to build a fully functional and elegant mobile application for all platform. We've build various mobile applications using these three technologies and they work awesome.
Since Grails fully support the concept of rest API for JSON and AJAX based calls, it is absolutely possible to use it along with AngularJS. AngularJS doesn't care about the server-side technology you are using as long as your server side code can communicate over JSON data.
Ionic is just a beautiful front-end SDK which works on the top of AngularJS and provides various utilities to develop a hybrid user-friendly mobile APP.
So you can easily use these 3 technologies and get your mobile app ready in a few weeks.
Ionic doesn't care about what you use as a server stack. As long as you create a service which has well defined interfaces (REST?), you should be fine.
I for example use PHP (yeah, I know, shocking, right?) Slim framework + Postgres database as my backend.

Sails Angular Frontend

Ok so I have looked around and cannot find the exact answer I am looking for. When developing a Sails app (which I am new to) it appears that by default it creates its own frontend using EJS.
Is this correct?
If this is correct then why is there an npm for sails generate frontend
If I want to use an Angular frontend is sails-generate-frontend-angular the best route to go?
Thanks!
First you need to separate server templating (EJS) from angular.
Just because sails defaults to an EJS template engine does not mean that you can not still put angular is your asset library and create and angular app. EJS is (the default but not the only option) what sails uses as a programming language for building its templates on the server that then get delivered to the client. Angular templates are used once delivered to the client to display information and perform tasks specifically already in the client machine.
1.) See above
2.) Sails-generate-frontend helps to setup your asset pipeline. It creates grunt tasks to copy image files and setup your javascript libraries such as ANGULAR.js, jQuery ect for use in your front-end.
3.) It could be. It depends, what a lot of people do is setup 2 projects. They use Sails as their API and then setup a second project for their Angular app (especially if its a SPA).
If instead your just using angular is specific places in your app (think jQuery style), then you would use a something like generate-front-end to take the angular library from someplace (like bower_compenents) and place it in your assets when you lift your app. It also makes it avaiable so that it can be placed in your html to be included in your app.
I on the other hand, use sails templates (I use Jade instead of EJS) to create and modify my angular templates on the server before they reach the client. This is a slightly advanced practice and can get confusing if you don't understand the difference between generating html on the server vs client.
An alternate method of thinking about this would be creating your index page on the server. This page would include your css and scripts. It would possibly be the only page on your server and everything else would be angular templates rendered on the client asking for JSON calls. In this scenario you would be using SAILS (ejs, or jade or whatever) to render only a single page INDEX.js and that might be the only server template you have.
However, this being said. Sails ships with this stuff already. You don't need sails-generate-frontend. Its is already inside a standard sails app.

Where to install Ionic with a Laravel backend?

I have an existing webapp built on Laravel. I am moving to an Ionic build to create the native version.
How would you suggest I separate my views, and how do I call the routes? Has anyone any example.
Here is what I am about to do:
1. move all my views to the public folder
2. install Ionic in the public folder,
3. Using UI-route & Angular make $http calls to the backend.
Thanks for your input :-)
You can't simply do that.
If you have a "classic" Laravel app with blade templates, what you need to do is to expose an API from it.
Then you create an ionic app in a different directory (they are not related, so you don't have to mix them). You just need to develop your ionic app like any other ionic app. Then in your factories where you do the request to your API, you do something like:
$http.get('https://example.com/api/foo')
Where example.com is the domain of your Laravel application (You are going to need to activate CORS in it).
You just can't simply create an ionic app inside laravel, because that application will be built into an .apk to be installed on the phone and you can't add Laravel inside the package.
So the TL;DR is having your normal Laravel app where it lives, add it some public API so your ionic app can access it and then build an Ionic app from zero that will use that API.
It depends on you, but I prefer to keep the ionic project nested in /public, since I want a single-project app, the sources are clearly separated by being or not in the subfolder, but it helps your productivity, benefits are:
Single source control: Single source set for source version control (GIT, SVN, ...), so when I work I can do a single pull/checkout and push/checkin
Single app to deploy: Single domain, no cross-domain problems, single deploy via FTP is available, any standard php server can handle it with a single and standard account to handle
Coherent project without interdipendencies: I do not want to split logic dependencies of the same model between many projects, when I change something in backend or frontend that involve the other side, I want to have in the same project all the sources to update. It make not sense to have to go to a different project to adjust compatibility, it would be uselessy messy

Upload files to Angular or Rails

I´m trying to integrate a Blueimp Jquery File Upload plugin in my application.
My application has an AngularJS front-end running in a Node.js server and a Rails API backend running in a WEBrick server.
I would like to clarify which is the best practices to store the files? In Angular (this case Node.js) server or the Rails one.
Thanks,
Roberto.
I'm working on an app that has the exact same layout as yours and I came to the same question.
Since I'm trying to separate the back-end and front-end completely and have all the work with the db and files done in the back-end, I found that it's better to save the files in Rails server. That also gives you an option to do background operations with files (using sidekiq, for example), without making users wait for completion in the front-end.
There are lots of tools for file upload from angularJS to the server (Rails), but I personally found angular-file-upload directive easiest to understand and implement. I recommend you check it out.
I hope it helps,
Ulugbek

Resources