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.
So i got the following structure:
4 tabs:
*dashboard *(with a button to open the modal)
objects (with a button to open the modal)
login (with a button to open the modal)
signup
And now the problem:
The modal opens on every site, when i click the button. But it only uses the controller, when i open it on site/tab login. When i open the modal on dashboard or objects, it didnât use the controller and the buttons in the modal for login (for example social login for facebook) do nothing.
I think it is a controller problem.
because you define the modal content in your index.html (so for all states).
But only the login-tab state is connected with the login controller, where your modal is built and connected to the the scope of the login-tab --> if you want to access the login modal you should move the modal creation and modal functions in an own controller and add this controller in the modal-template via ng-controller, or put everything in an base controller⊠which is around all other states.
put ng-controller=âloginCtrlâ in modal template
base controller in < body> will firing in every site/state, right?
where do i have to add ng-controller?
< script id=âcontact-modal.htmlâ type=âtext/ng-templateâ ng-controller=âloginCtrlâ>
< div class=âmodalâ >
< ion-header-bar>
âŠ
Is this right?
in the docs â> the modal is created in a controller --> and the modal gets the scope of the controller. This scope holds all methods and functionalities the modal needs.
In your case all you functionality of the login-tab-view is in the login-tab-controller. You need to create your modal somewhere âgloballyâ like in a base controller. There you can put all the functionality of your tabs-login controller OR you can add the login-tab-controller to your modal manually (it will get an isolated scope) with ngController.
In theory I understand what you mean, but I fail in the field.
I have tried to put my script in the index.html into a < div ng-controller=âLoginCtrlâ> , but this doesnât work.
And i have searched for some code snippets and tutorials for global controllers or social login modals, but didnât really found some useful sites.
Do you know any snippets or tutorial, which could help me solving this problem?
I open the Modal with a global Controller. Is it possible the have an separate Controller for the controller itself? So open with GlobalCtrl, but functions from ModalCtlr?