user2429082
user2429082

Reputation: 485

phonegap use multiple html file in one or one html file by page

I would like to know what is the best pratice in phonegap. Is it the used of multiple html file in one, or one html file by page. Or maybe there is not.

Upvotes: 1

Views: 719

Answers (1)

E. Valencia
E. Valencia

Reputation: 457

A generic rule could be:

If you do not need to share the Javascript run-time between your different app views, you can have multiple html files, one for each view.

On the other hand, if your views need to interact among them and share the Javascript run-time (i.e. variables, functions, and other objects) it is better to go for a single-page application within a single html file with different elements acting as your views.

In my experience, the widest adopted technique is the second one: implementing a single-page application, instead of several independent html pages. To do so, you can implement it from scratch or use one of the existing SPA frameworks such as AngularJS, jQuery Mobile, Ember, Backbone, etc.

Best.

Upvotes: 1

Related Questions