I'm tring to store logged in user information in Angular Cookies. Strangely it work's well in browser when I do ionic serve. Also works in phone debug mode using ionic run android -l-c --debug usb debugging mode. But when I do ionic build android user information does not get stored in the $cookiestore.
I have referenced <script src="lib/angular-cookies/angular-cookies.min.js"></script> in my index.html
Simply replace $cookieStore with localStorage. It plays nice with both Android and iPhone. :)
$cookieStore.set() -> window.localStorage.setItem()
$cookieStore.get() -> window.localStorage.getItem()
$cookieStore.remove() -> window.localStorage.removeItem()
Related
I have a Reactjs typescript project I want to transfer to native mobile platforms using Capacitor. I've successfully created the native projects for each, however there's an issue with the Google login feature I have in it.
The Google login API requires you to add a script tag to the index.html in the public folder for the React app which injects a variable used to do the logging in. This is the script tag in the index.html file:
<script src="https://accounts.google.com/gsi/client"></script>
I have a declare var google: any in a file where I do the logging in. This works fine in web but when I use Capacitor and open the Android version, it fails claiming that the google variable is not defined.
Why does this happen and how do I fix it?
I developed an application using nodes and angularjs.
I have an html file that I should display an image.
when running the application on localhost, everything work perfectly and the application displays the image.
I used this code for displaying image:
<img ng-src="./app/images/{{idimage}}.jpeg" ></img>
when I do a push for this application to ibmbluemix, the console told me that there are a 404 not found error.
Any idea please for how displaying image using angulars in ibm bluemix.
Thanks for helps
A possible reason for this issue is if you are pushing the app from outside of the app folder by using the manifest path parameter, and when you run your app locally, you also run it from outside the app folder.
After pushing your app, use cf ssh (docs) to get inside your deployed app. You can then take a look around using linux tools like ls to see what folders have been deployed.
So i got this example found at: http://odhyan.com/blog/2014/12/building-a-simple-quiz-app-using-angularjs/
, it's made as a desktop app, i copied the service, directive, controller in my ionic-app sources.
When i "ionic serve" and test the app in the browser, the application works as it should.
I managed to build the apk, but when i install it on native android (my phone Galaxy S6 Edge) and also tried in Android Studio (emulator - Nexus 5X used for tests in this case), the submit button won't work... I tried changing the "ng-click" to "ng-submit", "on-tap", "on-touch" one by one, and still not working.. i isolated the "ng-show"-s so i can try the other buttons. All are working properly (start quiz, next-question, Play again), but not the submit one.
What should i do to get this button working on android too as it works in desktop? Can anyone help please?
No errors in console while testing in browser where everything works as it should.
No errors at building app or ionic serving...
P.S. i tried all of the "answers found on stack overflow related to this behaviour" but no result :( !
Thank you very much !
I am using Ionic and Oauth.io to perform authentication. If I run ionic serve and include the outh.js file in my index everything works good from the browser.
But when I run ionic run ios or install the app in android, I get the following error when I press the auth button (the one that suppose to execute OAuth.popup
I do not know what to do, until now I have checked the following:
In config.xml I have access, allow-intent and allow-navigation full permisive
I have installed and re-installed the plugin ionic plugin add https://github.com/oauth-io/oauth-phonegap.git
I tried to run the native app without the inclusion of the oauth.js file and everything breaks.
Using current versions up to date.
I am new to Ionic, so I don't know how to debug the device-running app or simulator.
Could be similar to this post but not exactly .
Your advices will be appreciated.
I figure it out reading some posts. The OAuth initialization and references should be done after the device is ready, so it is best to put the initialize in this block:
$ionicPlatform.ready(function() {
// ...
if(typeof window.OAuth !== 'undefined'){
$rootScope.OAuth = window.OAuth;
$rootScope.OAuth.initialize('XXX');
}
else{
console.log("plugin not loaded, this is running in a browser");
$.getScript( "lib/oauth.js", function() {
$rootScope.OAuth = OAuth;
$rootScope.OAuth.initialize('XXX');
});
}
});
Now, if the plugin is loaded it initializes the window.OAuth object, else the app is running in browser, so I have to include the oauth.js file. Also I assigned the OAuth to the $rootScope for quick access.
Hope this helps anyone.
I am developing an hybrid app for Android and WP8 using Ionic. It works fine on Android platform but when I recently used this on WP8, its showing me
"You need to install an app for this task. Would you like to search
for one on the Store?"
When I click on some links (internal app links). Please can anybody tell me why this is happening. Thanks in advance.
Problem In windows phone Due to ms-appx IE problem :
When you use ng-href and dynamic url's in your app on Windows Phone, for example:
<a ng-href="#/view/"> click here </a>
You will notice that when you click on the url, you get a message "Search for app in appstore?". You receive this message because AngularJS can't handle the prefix that Windows Phone IE is adding.You can resolve this easily by adding an HTML5 him to your app.
.config([
'$compileProvider',
function ($compileProvider)
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|ghttps?|ms-appx|x-wmapp0):/);
// Angular before v1.2 uses $compileProvider.urlSanitizationWhitelist(...)
}
])
And if local & dynamic images are not showing in app then add following same as your app.js
$compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|file|blob|content|ghttps?|ms-appx|x-wmapp0):|img\//);
For more details to check here link1, link2 ,link3 and link4.
Install cordova-plugin-inappbrowser
In relation to this posting What is x-wmapp2 and x-wmapp1? it could also be diserable to have something like this:
$compileProvider.aHrefSanitizationWhitelist( /^\s*(g?https?|ftp|mailto|tel|file|local|ms-appx|x-wmapp\d+):/ );
Instead of only x-wmapp0 I am using x-wmapp\d+ in my regex.