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.

2
  • 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, 2014 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. :) Dec 25, 2014 at 17:03

2 Answers 2

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.

12
  • This is a very good answer. But still I don't understand how will database work in the mobile environment? Dec 25, 2014 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, 2014 at 17:30
  • So, I cannot use MySql in the mobile environment? Dec 25, 2014 at 17:46
  • 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, 2015 at 13:20
  • 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, 2015 at 13:36
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.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.