Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49184

App has no problem in browser, won't work in iOS

$
0
0

@blanketrock wrote:

Okay guys, I am really struggling here. My app is almost complete, everything works great in the browser so I am off to testing in iOS. The part of the app that isn't working is the functionality to favorite a bible verse which adds it to an array. I store all of this in a factory and use this factory to store it in local storage and display it and stuff. Again this works in the browser but when I click the favorite button in iOS nothing happens. I used console logs everywhere and pinned the problem down to one line. Here is the code I have issues with:

.factory('User', ['$localstorage', function($localstorage){

var o = {
	favorites: [],
	newFavorites: 0
}

o.addVerseToFavorites = function(verse){
	if(!verse) return false;

	console.log('fish');
	o.favorites.unshift(verse);
	// o.favorites[0] = verse;
	console.log('cat');
	o.newFavorites++;

	return true;
}

So the problem is with the o.favorites.unshift(verse); line. In this case it will print out fish but not cat and nothing happens. If I use the commented out line of code, it works but obviously this isn't the functionality I want. If anyone could help me out that would be greatly appreciated.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49184

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>