$location.url not working on ios

Hello
I have developed a ionic app which works perfectly in the browser.
Now I’m using cordova to build a iOS app but suddenly, $location.url("/register") is not working anymore. No js errors, no error messages, the page simply does not change when I press the button (the ng-click is triggered) and $location is defined. The route /register is defined with its own controller and again, it is working on android and on web browser.
Is there something to consider for ios webview which breaks the navigation?

I moved a bit forward

I replaced all the $location.url with $state.go; again, in the browser is working but no way to change page in cordova+ios. I think it’s something related to the url of the template which can’t be resolved.

I have the route config as follows:

.state('register', { url:'/register', templateUrl:'views/authentication/register.html', controller: 'RegisterController' })

And I just call

$state.go("register");

What happens is that I see the loading spinner but no page change.

I replaced templateUrl with some dummy template like this:

state('register', { url:'/register', template:'<h1>Test</h1>', controller: 'RegisterController' })

And this is actually working.

So I think the problem is the resolution of the views in cordova; I added this line

$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|file):/);

in my module config function but nothing working also in this case.

Then I wrote something like

$state.go("register").then(function(){alert("ok")},function(){alert("ko")});

and I got “ko” message.
Does anyone knows what the problem can be? It’s actually quite frustrating having such problems for just changing a page

You might want to include $stateChangeError in your Angular .run to see if it’s throwing a stateChangeErorr.

$rootScope.$on("$stateChangeError", function(event, toState, toParams, fromState, fromParams, error) {
    console.log("stateChangeError:");
    console.log(error);
  });

http://calendee.com/2014/05/30/ui-router-goes-boom/