Pen ID
Unlock Campus Themeforest adv




var app = angular.module('ionicApp', ['ionic', 'ui.router']);

app.config(function($stateProvider, $urlRouterProvider) {
  .state('login', {
    url: '/?card',
    templateUrl: 'login.html',
    controller: 'LoginCtrl'
  .state('forgot-password', {
    url: '/forgot-password',
    templateUrl: 'forgot-password.html',
    controller: 'ForgotPasswordCtrl'

app.controller('LoginCtrl', function($scope, $state, $stateParams, $ionicViewSwitcher, $ionicNavBarDelegate){
  $scope.showCard = false;
  if($stateParams.card) $scope.showCard = true;
  $scope.forgotPassword = function () {

app.controller('ForgotPasswordCtrl', function($scope, $state, $ionicViewSwitcher, $ionicNavBarDelegate){
  $scope.resetPassword = function () {
    $state.go('login', { card: true });
Host Instantly Drag and Drop Website Builder



When a user forgot his password, I want him to go to another view to reset his password. When the user clicks on the 'Forgot password?' button the view animates in and the back button is enabled to go back to the 'login' view. When the user resets his password I want to redirect him back to the 'login' view and show a message above the login form. To accomplish this I had to send a parameter. By just doing an $state.go() with a parameter, the animation goes forward instead of back. To redirect back I needed to set the animation direction before calling $state.go() and disable the back button, because the Ionic navigation stack things we're moving forward.
Wed, 11/29/2017 - 11:22

Related Codes

Pen ID
Pen ID
Pen ID