I have a form in Ionic and I am trying to return the value of a text box, but I have problems. The rest of the form loads, and the "console" returns to the console. formData.email is not template bound, and nothing returns to the console when I enter something and press a button.
Any tips on what to do?
signup.html
<div class="bar bar-header bar-light">
<button class="button icon-left ion-chevron-left button-clear button-dark">Back</button>
<h1 class="title">Signup</h1>
</div>
<div class="spacer" style="width: 300px; height: 50px;"></div>
<div class="list list-inset">
<form>
<label class="item item-input">
<span class="input-label">Email</span>
<input type="email" ng-model="formData.email">
</label>
<label class="item item-input">
<span class="input-label">Username</span>
<input type="text">
</label>
<label class="item item-input">
<span class="input-label">Password</span>
<input type="password">
</label>
<button on-touch="onTouch()" class="button button-positive button-block">
Sign up
</button>
</form>
</div>
{{formData.email}}
controllers.js
.controller('SignupCtrl', function($scope, $ionicLoading, $state, $stateParams){
console.log('signup');
$scope.formData = {};
$scope.onTouch = function(item,event){
console.log($scope.formData.email);
};
});
source
share