I want to add new row in table.Where table data is coming from database.which is as follow..

<div class="form-group form-horizontal" id="item" style="margin: 5px;">
    <label class="col-xs-2 control-label">Enter Barcode:</label>
    <div class="col-xs-2 selectContainer">
        <input type="text" class="form-control" ng-model="barcode" placeholder="enter barcode" />
    </div>
    <label class="col-xs-1 control-label">Quantity</label>
    <div class="col-xs-2 selectContainer">
        <input type="text" class="form-control" ng-model="qnt" ng-blur="putQnt()" placeholder="enter quantity" />
    </div>
    <button class="col-xs-1 btn btn-primary" ng-click="getInfo()">OK</button>
    <button class="btn btn-primary" ng-click="addItem()">Add Item</button>
</div>

Here I've to add barcode and quantity from barcode the select query would be fired and I get the data in one row. It's angularjs,

$scope.getInfo=function(){
        $http.get("../POS_System/widget/bill.php?barcode="+$scope.barcode).success(function(data){
           $scope.data=data;  
        }); 
      $scope.list={};
    }

Now when I'm adding new row it's overwrite the data.I didn't get the combine data.so what to do for adding new row from database according to it's barcode entry.Give me some suggestion for addItem() function.

share|improve this question
    
please add addItem function – RIYAJ KHAN 10 mins ago
    
please read a question I'm asking for that function.What would be that function? – Krish Patel 4 mins ago

You can do like this:

var tempvar = response.data;
var len = (tempvar.length);
if(len>0) {
     for(var loop=0;loop<len;loop++) {
         $scope.list.push(tempvar[loop]);
}
share|improve this answer
    
for what response.data is used?because I'm getting error for this.@Suresh Kamrushi – Krish Patel 6 mins ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.