1

I am new to AngularJS, PHP, PhoneGap. I am creating a mobile app using all of these. After lot of research, I have got this understanding of how to proceed with the development.

I am going to use AngularJS for development. A PHP script is used to connect the AngularJS part to the MySQL database.

Since this is my first time with all these technologies, what I don't understand is how will all of these work together as a mobile application. How will the database work when I use it as an app on my phone? How will the PHP script run automatically?

Sorry for the naive question but I really want to understand the concept behind it. Thanks.

halfer
  • 19,824
  • 17
  • 99
  • 186
clever_bassi
  • 2,392
  • 2
  • 24
  • 43
  • This is rather broad for Stack Overflow, but it's not clear how you plan to use Angular. Is this for desktop access to your web app, whilst Phonegap is for your mobile app? Or does your mobile app actually make use of Angular? If the latter, won't Phonegap do all you need without Angular as well? – halfer Dec 25 '14 at 12:03
  • It will, but its a requirement for me to use Angular for it. I am creating a mobile application for it. I know its really broad but no where did I find relevant information that would help me understand how all of these work together. :) – clever_bassi Dec 25 '14 at 17:03

2 Answers2

7

I also went through same situation five months back, then I successfully competed my first project using Phonegap, AngularJS and Ruby on Rails.

First thing, I will give overall flow how it will work.

  • Use IONIC for mobile UI (Fully supported with AngularJS).
  • Use Cordova/Phonegap for building APK.
  • PHP for server side API (accept JSON response JSON)

Make API in PHP which accept JSON object and gives back JSON object.

Then using AngularJS use $http directive to make call to API.

And API (in PHP) process that JSON data and gives return result in JSON.

And then integrate all this in APK with the help of Ionic/Cordova.

Mobile and server side PHP API code are communicating using JSON objects using AngularJS.

Please have look at following links:

For PHP API:

For Mobile and Server connectivity -

For mobile UI and AngularJS integration -

  • ionicframework.com

For starting point to make API in PHP and call that API from code pen. Test your API using any AngularJS $http codepen, JSFiddle or cURL command. Then go to the mobile (client side).

It works just like Client-Server model.

halfer
  • 19,824
  • 17
  • 99
  • 186
RockStar
  • 1,304
  • 2
  • 13
  • 35
  • This is a very good answer. But still I don't understand how will database work in the mobile environment? – clever_bassi Dec 25 '14 at 17:08
  • database will interact with php api and php api interact with your application. Mobile is not going to directly interact with database of server side. Their is also local database in mobile but again this database also need to need to synchronize with server database. – RockStar Dec 25 '14 at 17:30
  • So, I cannot use MySql in the mobile environment? – clever_bassi Dec 25 '14 at 17:46
  • For mobile environment use have to use SQL lite database. But for server side database you can use any database.(I also use MySQL at serer side database but sql lite for mobile env.) – RockStar Dec 25 '14 at 18:05
  • Because Cordova/phonegap support SQL Lite database in mobile environment. have look at this link https://github.com/brodysoft/Cordova-SQLitePlugin. and http://stackoverflow.com/questions/10329842/why-to-use-sqlite-database-in-android – RockStar Dec 25 '14 at 18:08
  • @RockStar : whether you have used Ruby on Rails (or) PHP for server side connection. where Ruby on Rails is come into picture. can you please clarify this? – Wanna Coffee Jul 29 '15 at 13:12
  • 1
    @Wannacoffee For API I have been using it. yes we can use `Sinatra` here but for certain reasons we used RoR. And mentioned it because whether it's RoR or PHP but it's conceptually and with respect to question it's similar situation. – RockStar Jul 29 '15 at 13:20
  • so I can go with PHP with out any issues?? and how for you got online support to develop the application using this technologies?? I assume ROR is not mandatory here. – Wanna Coffee Jul 29 '15 at 13:27
  • 1
    @Wannacoffee yes absolutely right. RoR is not mandatory. You can go for Java also ;-) . If you are asking about online support then you will have choices of solutions :) . – RockStar Jul 29 '15 at 13:36
  • @Wannacoffee if this answer helps you feel free to like it. :) – RockStar Jul 29 '15 at 13:38
  • Thanks, If you don't mind can i get your contact so that i will get clear some of my doubts if you are free.!! – Wanna Coffee Jul 29 '15 at 13:39
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/84577/discussion-between-wanna-coffee-and-rockstar). – Wanna Coffee Jul 29 '15 at 13:41
1

First you need to about Phonegap(aka Cordova) is an open-source mobile development framework. It allows you to use standard web technologies such as HTML5, CSS3, and JavaScript for cross-platform development, avoiding each mobile platforms' native development language.The Cordova-enabled WebView may provide the application with its entire user interface. On some platforms, it can also be a component within a larger, hybrid application that mixes the WebView with native application components. A plugin interface is available for Cordova and native components to communicate with each other. More..

Angularjs is a structural framework for dynamic web apps. It use HTML as your template language and extend HTML’s syntax to express your application’s components clearly and succinctly. More

PhoneGap+AngularJS

Now PHP is server side scripting language. You can make web services in JSON and XML. Here is example for this. you can see. Tutorial...

Its big topic all is not possible here. So its brief info all about. So need to learn about this. Hope may be help you this answer.

Ved
  • 2,701
  • 2
  • 22
  • 30