I am working on a Cordova app developed with AngularJS.
I find that $cookies is not working in an Cordova/Phonegap app since the pages are served as a file URL. In an normal desktop browser it is also not working if you serve the pages from the filesystem - it's WORKING when served via a server or localhost.
So I get to the assumption that angular $cookies don't work for Cordova apps.
Maybe theres a workaround for that? I just don't know, maybe someone nows an answer.
Cordova not allows to use cookies
but you can easily move them to localStorage
try: bower install angular-cookies-mirror
Related
I have a webapp which I build with Angularjs 2.0, I want to convert it to android apk and install it on android phone and test.
I dont have any experience in building mobile native app or converting webapp to native app.
I have gone through How to convert an existing AngularJS web app to a Cordova app?
Any suggestion/guidance will be helpful.
The most simple explanation is you will need to put your angular files in the www folder, setup your configuration file, make sure the android platform is installed, then run the Android emulate and/or build command to see if it works. That's a very oversimplified version.
Once you've got it working there's a process to go through to prepare the apk to be uploaded to the Google Play Store. You have to be a registered developer for the play store, which is $25/year.
https://scotch.io/#vijayk036/building-hybrid-mobile-apps-using-cordova-and-angularjs-for-android
https://thebhwgroup.com/blog/converting-angularjs-website-cordova-app-ios-and-android
I am building a hybrid mobile app using the Ionic Framework library (including Angular JS) and have found that they've made a wrapper for a number of the cordova plugins so that they work with Angular.
I have downloaded the ng-cordova.js file and referenced it in my index.html
As as test I have used the cordova device plugin just to display the device name in a popup. It works fine in the ripple emulator just running the html in my browser, however when I build the app using Phonegap Build it no longer works.
Is it not possible to use the ng-cordova.js file to access native device features when using Phonegap Build? (i.e. Can you literally only use the plugins from the list on the build website?)
As another user of PhoneGap Build, you are limited to whatever plugins can be found here:
https://build.phonegap.com/plugins
That being said, if the plugin is not in their repository already (most of the popular ones are), you can always submit it yourself or try to get the author to submit it.
Other than that, it should work fine.
This is ngCordova contributor.
It should be possible to use ngCordova with PhoneGap, but are you using the same plugins repos as they are mentioned in ngCordova documentation?
I can imagine that PhoneGap plugins my have different API than Cordova plugins.
And what is here the reason to use PhoneGap Build, if I may ask?
Can you specify which plugins are not working and how could I simply replicate your errors?
I've made an angular app. Not fully completed, but it's working fine on my localhost.
I bought a DigitalOcean droplet and I've pushed my app in there.
The problem is that when I click on a link, everything is loaded properly. But then the link just goes to the root link. Is there something you have to set in some kind of configuration for angular apps from development to production mode?
Maybe it has something to do with my apache2 config? Again, everything is working fine on localhost.
FYI: I'm using the Laravel framework as REST api.
My server is accessible at: http://95.85.10.155/
Hope someone has a solution.
Do you have mod_rewrite installed/enabled? Laravel requires it. See the installation documentation for more information.
http://laravel.com/docs/installation
Well, it's solved. The .htaccess didn't rewrite the .index.php in the url. So I've tweaked it and it all good now.
We will develop application in Angular (separated from server), and most likely we will need to use PhoneGap to create same application for mobile devices.
PhoneGap requires that the application has index.html file as entry file in order to be compiled. I made minor project in Angular that has index file, and it did compile ok in PhoneGap.
There is something that I cant get my mind on. Server side will be in C#/MVC, and as I said already Client will be in Angular. Question is how to keep the project in Angular in "index.html" format ready for PhoneGap and at the same time have it available for normal web application.
We do plan to use AMD (require.js) for Angular application, but if we do that then we cant have Index.html file which is required for Phonegap.
What would be best approach. Goal is to if possible have one code base.
Well you don't have to specifically have an index.html page, you can use any HTML page as the landing page (See the content tag in the Config.xml page.) You should be able to just build your Angular app like you normally would - you can even test on the browser. When you go to actually create the Cordova/Phonegap apps, you'll just have to add the cordova.js to the file and then run the commands to build and package the app binaries.
I'm also building a PhoneGap 3 app using AngularJS connected to back-end APIs.
The PhoneGap / Cordova part is only added later in the /platforms folder, so in the root /www folder you should build just a regular mobile web app.
This app I'm working on uses a hash for the AngularJS routing. In iOS / Android runs from index.html (eg: ./index.html#/start) while on desktop browsers runs from the root folder (eg: /#/start).
I have a backbonejs application in my yeoman dev environment. My application uses pushstate, however this causes the connect server to issue 404s when the page is reloaded (via live reload) or when I try to directly access a url. This is somewhat annoying right now, as I have pushstate support working under an nginx proxy, but I would like to have this ability in my dev environment too.
I've been having a similar issue with my AngularJS application and Yeoman. I used the 'connect-modrewrite' middleware to rewrite all URLS that weren't pointing to specific resources. Found the solution here => http://ericduran.io/2013/05/31/angular-html5Mode-with-yeoman/