I am a newbie developing app with ionic can some please point me to a
tutorial that will teach me how to create registrations and login form in angular js for ionic app and how to conditional routing . I have been on this for two days now please some one help.
controllers.js
angular.module(‘starter.controllers’, [])
.controller(‘AppCtrl’, function($scope, $ionicModal, $timeout) {
// With the new view caching in Ionic, Controllers are only called
// when they are recreated or on app start, instead of every page change.
// To listen for when this page is active (for example, to refresh data),
// listen for the $ionicView.enter event:
//$scope.$on(’$ionicView.enter’, function(e) {
//});
})
.controller(‘LoginCtrl’, function($scope, LoginService, $ionicPopup, $state) {
$scope.data = {};
$scope.login = function() {
LoginService.loginUser($scope.data.username, $scope.data.password).success(function(data) {
$state.go('app.dashboard');
}).error(function(data) {
var alertPopup = $ionicPopup.alert({
title: 'Login failed!',
template: 'Please check your credentials!'
});
});
}
})
.controller(‘RegistreerCtrl’, function($scope, $stateParams) {
})
.controller(‘ForgotpasswordCtrl’, function($scope, $stateParams) {
})
.controller(‘DashboardCtrl’, function($scope, $stateParams) {
});
Registreer View
<label class="item item-input item-select">
<div class="input-label">
Aanhef
<option selected>Meneer</option>
<option>Mevrouw</option>
</select>
</label>
<div class="list">
Voornaam
Achternaam
Uw e-mail Adres
Uw wachtwoord
Uw bevestig wachtwoord
Uw(mobiel) telefoonnummer
Uw adres + huisnummer
Uw postcode(1234AB)
Uw woonplaats
Verstuur
Login View
<div class="padding">
<a href="#/app/registreer" style="text-decoration: none;"><button class="button button-block button-positive">Registeer hier</button></a>
<a href="#/app/forgotpassword" style="text-decoration: none;"><button class="button button-block button-positive">Password Vergeten?</button></a>
</div>