Search code examples
angularjscontrollermodal-dialogionic-frameworkbackand

modal - buttons not working - controller failure


I use the backand-app from ionic market. Now i try to have the login as a modal. On standard i have a login-tab, where user could do the login. But this is not really nice, so i want to do it with a modal and remove the login-tab.

And now the problem: The modal just do login when I open it on the login-tab. When I open it on an other site, for example objects or dashboard, the modal opens, but the login-buttons do nothing. I think it is a controller problem.

I uploaded the files to git: https://github.com/AndreDriesel/ionic-backand-app

Do you have any idea why it doesn't work?


Solution

  • I found the reason why facebook login modal didn't work in your app. The view assume that LoginCtrl name is "login", so all methods is called with this assumption. For example "login.socialLogin('facebook')".

    In your code, you call the right controller but don't give him appropriate name.

    In code, you have to change a little line, and everything will work fine.

    In tab-objects at line 25 old line is:

    <button class="button button-icon ion-ios-person" 
    ng-controller='LoginCtrl' ng-click="openModal()"></button>
    

    and new one is like this

    <button class="button button-icon ion-ios-person"
    ng-controller='LoginCtrl as login' ng-click="openModal()"></button>