mercredi 25 mars 2015

Angular, get dynamic value of textbox to controller


i fetch from json and set the value to my angular ionic app. my textbox holds the value. but im unable to get the textbox value to controller. this is how i have done it


controller.js



$http.post("http://ift.tt/1FFyvmb).success(function(details){
$scope.mydetails= details;
});


and i set the value to my html page



<form>
<div ng-repeat="data in details|limitTo:1">
<p>{{data.f_name}}</p> <!--displays the value-->
<input type="text" ng-model="v.name" value="{{data.f_name}}"/> <!--empty values-->
<input type="text" ng-model="v.id" value="{{data.id}}"/> <!--empty values-->
<button ng-click="push(v)">
</form>


on form click i dont get the textbox values to my controller, im trying to get the vaules to the controller. it doesnt appear



$scope.push= function (v) {
var push_name = v.name; // empty values
var push_id = v.id; // empty values
}




Aucun commentaire:

Enregistrer un commentaire