How to return text box value using Ionic?

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

<!-- Header -->
<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>

<!-- Space between header and signup form -->
<div class="spacer" style="width: 300px; height: 50px;"></div>


<div class="list list-inset">

    <!-- Signup form text fields -->
    <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>

        <!-- Submit button for signup form -->
        <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 = {};

    //Go to the guessing page
    $scope.onTouch = function(item,event){
        console.log($scope.formData.email);
    };



});
+4
source share
1 answer

, , , , , , - , undefined. , Angular Ionic. : https://docs.angularjs.org/api/ng/input/input%5Bemail%5D

+3

All Articles