search

Home  >  Q&A  >  body text

angular.js - How to transfer the properties of one object to another object in angularjs? ?

As follows, I want to transfer the attributes of the item object to quotation...

$scope.quotation = {};
                            
        $scope.save = function(item) {
                                
    for ( var key in item) {
                                    
    
        console.log($scope.quotation);
                            }
                            
                            }
                            
我想大声告诉你我想大声告诉你2769 days ago1544

reply all(2)I'll reply

  • 黄舟

    黄舟2017-05-15 17:04:31

    For direct useangular.copy(source, [destination]);对比你的例子就是angular.copy(item, $scope. quotation); you can see here.

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-05-15 17:04:31

    angular.extend
    or
    angular.copy

    reply
    0
  • Cancelreply