this html.
want values input field , pass controller.
<fieldset class="col-lg-12" ng-repeat="field in newfield"> <div class="col-lg-6" style="padding:0 16px 0 0;">variants <input type="text" class="form-control" ng-model="field.variantname" placeholder="option name"> </div> <div class="col-lg-6" style="padding:0 0 0 16px"><br> <input type="text" class="form-control" ng-model="field.variantvalue" placeholder="value" > </div> </fieldset>
here controller:-
add(prod) { var id = this.saveddataprod.length; var json = { "id" : id, "variantsname" : prod.variantsname, "variantsvalue" : prod.variantsvalue }; this.saveddataprod.unshift(json); };
see simple pass input value controller.
because angular supports 2 way data binding.
for ex.
<form name="myform" ng-submit="registration()"> <label> name </lbel> <input ng-model="name" /> </form>
here if want use input name
in controller then,
$scope.name = {}; $scope.registration = function() { console.log("you name here ", $scope.name); };
in case,
controller should like:-
.controller("mycontroller", function ($scope) { $scope.newfield = // add data want });
Comments
Post a Comment