Reputation: 80
I am using angular to build a waitinglist-system, where you first join a waitinglist, and then can be moved to the memberlist. I use ng-repeat
to fill inn the table with the rows of waiting people, and I assign a button to each row, which can be pressed to move that particular person to the memberlist.
First problem: I am not sure if i assign the value to the button in the correct way. It is supposed to be the email of the person.
<input type="submit" ng-click="makeMember()" ng-model="member" value="Member" id="{{person.email}}">
Second problem: I want to use this users email in order to make a sql query to send to the database to move the person to the memberlist (email is primary key).
I am trying to use $scope.member
to reference the ng-model
, but that only gives me an undefined value.
The makeMember
function is just to see if it works (which it doesnt).
$scope.makeMember = function() {
alert("Person email: " + $scope.member);
};
Any help is highly appreciated!
Upvotes: 2
Views: 411
Reputation: 43775
Pass member
in like this: ng-click=makeMember(member)
.
$scope.makeMember = function(member) {
alert("Person email: " + member);
};
The issue you are having is that $scope
refers to the controller's scope
, not the child scope created by ng-repeat
. The only way $scope.member
would work is if you had defined it in the controller.
Upvotes: 2