I have an angle app for a page. The landing page is a signin form with a link to a sign up form. The rest of the application is not visible until the user is authenticated. I swap signin and signup pages using the NG-switch directive. So when the signin form loads and the user clicks the "sign up" button, the NG-switch directive partially swaps the signup for signin partial. I have to partly sign the NG-switch back to the "createAccount ()" function and after submitting the sign-up form. Is this possible? Right now, when I click on submit, it switches ng and ignores the createAccount () bit.
& lt; Body ng-controller = "MainCtrl" & gt; & Lt; = "View.controller" on the div ng-switch & Lt; Div ng-cloak class = "ng-cloak" ng-switch-default ng-controller = "UserCtrl" & gt; & Lt; Div ng-show = "! Is invalid" & gt; & Lt; Form class = "form-signin" & gt; & Lt; Div class = "control-group" & gt; & Lt; Div class = "control" & gt; & Lt; Br / & gt; & Lt; Input type = "text" ng-model = "user name" placeholder = "email address" & gt; & Lt; / Div & gt; & Lt; Br / & gt; & Lt; Div class = "control" & gt; & Lt; Input type = "password" ng-model = "password" placeholder = "password" & gt; & Lt; / Div & gt; & Lt; Div class = "control" & gt; & Lt; Button class = "btn btn-primary" ng-click = "sign in ()" & gt; Sign in & lt; / Button & gt; & Lt; Button class = "BTN BTN-Default" ng-click = "view.controller = 'accountExicon'" & gt; Register & lt; / Button & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Form & gt; & Lt; / Div & gt; & Lt ;! - Start of sign up form - & gt; & Lt; Div ng-switch-when = "accountNewCtrl" & gt; & Lt; Div ng-controller = "accountNewCtrl" & gt; & Lt; Div ng-cloak class = "ng-cloak" ng-show = "! Is invalid" & gt; & Lt; Div class = "page-header" & gt; & Lt; H1 & gt; Sign up & lt; Br / & gt; & Lt; / Div & gt; & Lt; Div class = "col-xs-6" & gt; & Lt; Form id = "myForm" name = "myForm" ng-submit = "createAccount ()" & gt; // Form input code here // Click on this button, createAccount () function, and then there should be ng-click event Register & lt; / button>
You can do this in the createAccount () function
$ scope. $ Parent.view.controller = 'UserCtrl';
On the Submit button, the ng-click
is not required.
Comments
Post a Comment