Skip to content Skip to sidebar Skip to footer

Change In Ng-model Value Getting Changed In The Other Parts Of The List Also

I have a view which i am displaying to the user it is a Result list and i'm displaying it on the screen. From view user will be able to click on hyperlink that will allow him to mo

Solution 1:

You are able to see response for other customers because you are not setting the scope variables to null after setting them with changed data of one customer.

First of all, if the response data contains multiple values then you need to modify the 'searchresponse' array instead of single scope variables. I do not see how you are persisting the modified changes.

You need to run a for loop through 'searchresponse' find the record to be modified and update it and not through scope variables like you are doing it now. Try using this logic

    angular.forEach(searchresponse , function (item) {
       angular.forEach(item.items, function (element) {
           if(element.customerId==details.customerId){
              element.emptype=details.emptype;
            //all the data that is changed.. update here
           }
        })
    })

Post a Comment for "Change In Ng-model Value Getting Changed In The Other Parts Of The List Also"