angular.js - angularjs如何把一个对象的属性 转移到另一个对象中??
我想大声告诉你
我想大声告诉你 2017-05-15 17:02:31
0
2
1481

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

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

Antworte allen(2)
黄舟

直接使用angular.copy(source, [destination]);对比你的例子就是angular.copy(item, $scope. quotation);可以看这里。

给我你的怀抱

angular.extend

angular.copy

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!