[RESOLVED][UI-SREF] doesnt work until another button is activated


#1

Hello,

I create a login page with 2 choices (FB and classic form):

<ion-view title="Login">
	<ion-content class="login" scroll="false">
		<div class="logoGoStretch" ui-sref="signin"></div>
		<div class="logoFB" ng-click="facebookLogin()" ></div>
		<div id="fb-root">
	</ion-content>
</ion-view>

In app.js:

$urlRouterProvider.otherwise('/login');

$stateProvider
    .state('login', {
        url: "/login",
        templateUrl: "templates/login.html",
        controller: "LoginCtrl" 
    })

    .state('signin', {
        url: "/signin",
        templateUrl: "templates/signin.html",
        controller: "LoginCtrl" 
    })

Nothing is displayed when I click on ui-sref=“signin”, and also when I go directly to localhost:8100/#/signin

But the link works and form is displayed if I click on ng-click=“facebookLogin()”, come back to login page and click to ui-sref=“signin”

Please, I need help.


#2

According to the doc, ui-sref is a directive that binds a link (<a> tag) to a state.

You’re using it on a div.


#3

I changed to :

<a class="logoGoStretch" ui-sref="signin"></a>

But its the same


#4

Sorry,
I forgot a little thing in my code :

if (toState.name !== "login" && toState.name !== "logout" && !$window.sessionStorage['fbtoken']) {
        
        $state.go('login');

Of course it was impossible to go to sign-in page

Shame on me :smile: