mardi 1 mars 2016

How to pass data from a label to a controller

signup.html

<ion-view view-title="Sign Up" >
<ion-content class="padding">
    <div class="list">
        <label class="item item-input item-floating-label">
            <span class="input-label">First Name</span>
            <input type="text" placeholder="First Name">
        </label>
        <label class="item item-input item-floating-label">
            <span class="input-label">Last Name</span>
            <input type="text" placeholder="Last Name">
        </label>
        <label class="item item-input item-floating-label">
            <span class="input-label">Email</span>
            <input type="text" placeholder="Email">
        </label>
        <label class="item item-input item-floating-label">
            <span class="input-label">Password</span>
            <input type="text" placeholder="password">
        </label>

        <button class="button button-block button-positive"ng-click="insert('averyto8@vt.edu')">
            Sign-Up
        </button>
</div>
</ion-content>
</ion-view>

app.js

     .controller("MembersController", function ($scope, $cordovaSQLite) {

     $scope.insert = function (email, password, firstname, lastname, gender, dateJoined) {
         var query = "INSERT INTO people (email, password, firstname, lastname, gender, dateJoined, weeklyPoints, totalPoints) VALUES (?,?,?,?,?,?,0,0)";
         $cordovaSQLite.execute(db, query, [email, password, firstname, lastname, gender, dateJoined, weeklyPoints, totalPoints]).then(function (res) {
             alert("INSERT ID -> " + res.insertId);
         }, function (err) {
             alert(err);
         });
     });

I am trying to pass all of this member information into the controller in my app.js file. I can't seem to find how to send user generated data from my html to the controller. Any help would be greatly appreciated.

Aucun commentaire:

Enregistrer un commentaire