Home  >  Q&A  >  body text

angular.js - angularjs如何把一个对象的属性 转移到另一个对象中??

如下,我想把item对象的属性转移到quotation...

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

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