I am trying to set my login page as the initial state When the user clicks on the user's registrar, then I register the page for $ US state. The controller (in the controller) from which the user should be able to return to the login page Config (['$ stateProvider', '$ urlRouterProvider',
angular. Module ('starter', ['ionic', 'starter.controllers', 'ui.router']) function ($ StateProvider, $ urlRouterProvider) .state ('login', {url: "/ login", templateUrl: 'templates / login.html', administrator: 'login copy'}) .state ('login.registerUser', {Url : "/ RegisterUser", idea: {'menuContent': {templateUrl: 'Templates / registerUser.html', Controller: 'registerCtrl'}}})
Controller
.controller ('Loginctrl', ['$ scope', 'AUTH', '$ state', '$ ionicPlatform', 'session service', function ($ scope, AUTH, $ state, $ ionicPlatform, SessionService) {$ ionicPlatform.ready (function () {window.scope = $ scope; $ scope.credentials = {user Name: "", password: "", Remember: ""}; $ scope.userData = {username: "", id: ""}; var utils = {createNewUser: function () {console.log (' here '); // I can see it / could have $ State.go (' login.registerUser '); // Nothin Hopens}}; $ Scope.goToRegistration = utils.createNewUser; });
}])
But it is not doing anything please help
Your syntax is slightly confused, try it:
Angular Module ( 'starter', [ 'ionic' starter. Controllers', 'ui.router']) .config ([ '$ stateProvider', '$ Url routerprovider', function ($ stateProvider, $ urlRouterProvider) {$ stateProvider Kstate ( 'login', {url: "/ login", templateUrl: 'templates / login.html', controller: 'LoginCtrl'}) .state ( 'Login.registerUser', {url: "/ registerUser", scene : { 'menuContent': {templateUrl: 'Templates / registerUser.html', controller: 'registerCtrl'}}}}});
Comments
Post a Comment