HTML5 mobile app with dynamic content - mobile

I'm creating a mobile app using HTML5 combined with PhoneGap. On every tutorial I watched, they only use static HTML content.
How could I do to load dynamic content (from a MySQL database on a my server), like news for instance ?
Can't I use PHP? Or do I have to use ajax calls to get the data and build the HTML via JS/jQuery ?
In this case, is it better to save the data? If so, is there an alternative to localStorage ? Isn't it simplier to save datas in a javascript object ?
Thank you for the answers

I usualy use ajax to get data from MySQL, i think dats an alternative, however u can use webSQL for IOS and Android and IndexedDB for WP if u wish to use phone localstorage. But i think WebSQL is deprecated so IndexedDB will b the best alternative for localstorage check this tutorial for indexedDB by Pual Kinlan:
TODO

Related

Load firestore data before google bots watch the content?

How can I load the firebase data before Google sees the content?
For example, retrieve data and render it with h1, p and other html tags, but my problem is SEO. I've been watching Gatsby JS but I don't need something like that.
On Firebase, the SEO is called App Analytics and it's possible to disable it on your database. However, you can only disable it generally and not load the data before it starts, once it's activated, it's always working, unfortunately.
I would recommend you to raise a Feature Request for this to be implemented here, so Google can check for further development.
Besides that, in case you want more information about how this is possible, you can check the below documentation.
Disable Analytics data collection
In addition, this question from the Community - How to use Cloud Functions for Firebase to prerender pages for SEO? - there is a case that I believe might help you, since it's about pre-rendering content. This is for another type of use case, but I believe it might help.
Let me know if the information helped you!

Best way to store data in a local Data Base in an application built using Angularjs and Electron

I am building an app using angularjs which is then ported to multiple platform using electron. The app needs a DB to store large set of data so which storage option is better. i want to use sqlite but will it work or correctly build in electron
You can store data in indexeddb. It is fast and completely html5 technologies.
Although indexeddb may be tough to understand for some users, so you can use any idb library which makes things easy for you.
Check out example of storing data using indexeddb library jsstore in electron - https://github.com/ujjwalguptaofficial/JsStore/tree/master/examples/electron
Yes you can use Sqlite with electron. Check out this answer which has further links and details.
https://stackoverflow.com/a/41230765/324143

value of localStorage in crosswalk lost after restart app

I use ionic to create my app.
Because perfomance problem in android device so i have to integrate app with crosswalk,.
My app use localStorage to store many setting info , use it like local variables
My problem is when use crosswalk, each time i restart the app, variable store in localStorage is lost!
After do alot of solution, i try:
https://github.com/ocombe/angular-localForage --> This solution can storage persistent value & variables, but it use promise to get the value, isn't like localStorage way ( just set value for variables, use it synchronize ). So this not my goal, use as localStorage
https://github.com/munisense/cordova-plugin-local-storage-retrieval.git --> A Cordova plugin to be used with alternate browsers to retrieve localstorage from default system browsers --> But when i use this plugin, problem still occur
Some version of framework used in my project:
ionic 1.7.14
cordova 5.4.1
crosswalk 18+
Please help me solve this!

Asp.Net MVC and AngularJS in same View

I´d like to know if exists a better way to render a view like this:
For the first load I need bring data from Controller like usual but after apply a filter in same page I need to start use AngularJS and never more uses Razor.
Is there a way to do that ?
Thanks for all.
Yes. you can do that.
Basically, you'd need to add the line below in your view. After you do that, the json is going to be available to the DOM / javascript and angular can take it from there. Hope this help
var json = '#Html.Raw(Model.MyJsonStringForMyCoolAngularJsApp)';
There are multiple ways to implement ASP.Net MVC with AngularJs.
I personally like Mini SPA (Silos). You can watch Miguel A Castro's video here.
You can also download the source at his website.
What it does is when a request comes in, it goes to ASP.Net MVC Route first. Then, Angular Route takes over the rest. It is a very slick design.
FYI: I also use Angular.Net Helpers to generate strongly typed views.
You could use WebAPI project in visual studio to exchange data between frontend and backend. It would go stateless, so to secure the data, you could use a mechanism like JWT.
The frontend would exchange JSONS from/to the backend using REST apis.
Yes. You can make angular views and exchange data using $http.get(/controller/method/). You can also configure routing using ngRoute.

Where to store Session Attributes with angular js

I am new to Angular JS, have experience on building spring web applications.
My requirement is to store the some session preferences (Not part of the user Model/entity) into session. I need to use them through out the application.
I couldn't find the right way to do it. I found some options, need suggestion on which one to use it.
ngStorage - can access Local/session storage and store attributes in it.
LocalStorageService - another githubproject, i can use it to store in session storage/ local storage.
Based on the articles i found, localstorage keeps the data even after logout, so have to make sure i clean all of them after logout.
What is the common practice to store session attributes?
I am planning to use ngStorage directive and use sessionstorage and store it by encoding with Base64. Is it a good way to do it?
I am using Java 1.7 and Angular JS for building an application. I have used JHipster to generate the application.
Any Help Appriciated!!!!
welcome! Well, depends the situation, localStorage is an excellent option to store attributes, but yes, it has some limitations and you have to remember to delete this. Another options is to use Cookies of angular project to store attributes on Client Side. I used in some projects and works perfectly for my use case. But if you are using Java, the best way is protect this session attributes using Java HttpServletSessions. I Hope it helps.
i had the same issue and i resolved by find the answer of this question: https://stackoverflow.com/a/922058/5995665
I hope it helps.

Resources