Im new to mobile development, especially using Ionic. Please help me
I have this code for my route
.state('auth', {
url: '/auth',
templateUrl: 'templates/login.html',
controller: 'AuthCtrl'
I have this code for my login.html
<ion-view view-title="Login" name="login-view">
<ion-content class="padding">
<div class="list list-inset">
<label class="item item-input">
<input type="text" placeholder="Mobile Number" ng-model="mobile_number">
</label>
<label class="item item-input">
<input type="password" placeholder="Password" ng-model="password">
</label>
</div>
<button class="button button-block button-calm" ng-click="login()">Login</button>
</ion-content>
and for my AuthCtrl
.controller('AuthCtrl', function($scope,$auth,$state) {
$scope.login = function() {
var credentials = {
mobile_number : $scope.mobile_number,
password : $scope.password,
}
console.log(credentials);
$auth.login(credentials).then(function(data) {
$state.go('tab.dash', {});
});
}
})
I always get this object {mobile_number: undefined, password: undefined} when calling console.log (credentials) I always set values in my forms, but always undefined. Why?
source
share