Andrew Rhyne
Andrew Rhyne

Reputation: 5090

AngularJS + PhoneGap

I'm hopeful this issue has already been approached. Does PhoneGap work with AngularJS? Are there any limitations to using them together? Benefits/pitfals? Thanks

Upvotes: 10

Views: 5954

Answers (7)

Sam Tsai
Sam Tsai

Reputation: 494

From PhoneGap's blog:
http://phonegap.com/blog/2013/07/31/phonegap-30-faq/

Q: Does PhoneGap play well with angular.js? Or any other framework?

A: It sure does. PhoneGap does not dictate how an app gets authored with HTML, CSS, and JavaScript. We play nice with all frameworks and, of late, many are being authored today with Angular.

Upvotes: 0

Alexandru Nedelcu
Alexandru Nedelcu

Reputation: 267

Yes. http://ionicframework.com is a framework that integrated Cordova and AngularJS. It will save you a lot of time trying to get everything set up.

To install the framework:

npm install -g cordova ionic

To create new empty:

ionic start myApp blank

All the options available in phonegap are also available in Ionic. For example, you could type

ionic serve

And your mobile app will open right in the browser, and auto-update whenever new changes are made to the files, just like in Phonegap.

Upvotes: 0

overbyte
overbyte

Reputation: 648

I've found that the brian t ford article (which everyone references) doesn't really explain how the config file is picked up (which includes the pointer to the index.html file and several other assets) which marks it out as a little out of date. It would be great to get a good update on it.

Upvotes: 2

gartox
gartox

Reputation: 891

I am currently working on a project with Phonegap and AngularJS. I do recommend the following reading. Will help you decide if it's what you want in an hour.

http://briantford.com/blog/angular-phonegap.html

AngularJs will let you have the power and structure of a website but it has a small flaw is that it is a bit slow, I say this from experience and it happens that sometimes the models take a while to cool off.

Likewise, I recommend that you take a look at Yeomen, I am currently working on a generator angularJS phonegap and hope to have it for this weekend.

regards

@gartox

Upvotes: 1

Arran
Arran

Reputation: 111

I'm having trouble getting angularjs working on windows phone 7 with phonegap. The simple stiff works, but as soon as I try to add page route...

[Edit]

Ok. So I have found the problem on windows phone 7/8.

in the function matchUrl(url,obj) in angular.js (1.0.3) there is a regex that fails because Windows Phone use an unusual prefix or namespace or whatever it is called (probably for security purposes).

What happens is angular is expecting a url like 'http://localhost/www/index.html' but in windows phone it will look like: 'x-wmapp0:www/index.html' instead.

I tried fixing the regex, but even so I get an error later on from XHR.

Upvotes: 3

Andrew Joslin
Andrew Joslin

Reputation: 43023

Yes.

I have made multiple applications with PhoneGap plus AngularJS. There's no magic to it.

Upvotes: 10

JBCP
JBCP

Reputation: 13485

PhoneGap just runs your application within the native device browser, so if AngularJS is supported on your target platforms, it should work with PhoneGap.

Upvotes: 3

Related Questions