AngularJs:如何将两个或多个范围合并到单个范围中

时间:2014-06-21 11:56:20

标签: php angularjs angularjs-directive angularjs-scope angularjs-ng-repeat

实际上我从多个范围的注册表中发送数据,即(veh_register,noofpass,avilableData,founderClass).......

每个范围对象都有类似的数据         veh_register:{" vin" :vin89," vplnum" :AR 890S," uni" :proxu}         noofpass:{noofpass:900}         availableData:{" Class" :9009," name" :manish}         等......就像那样

然后如何将它们组合为单个范围对象,以通过$ http.Post

发送它

这是Clear Cut Code .........

AngularJs中的控制器方法

$ scope.vechicle_Register =函数(veh_register,noofpass,avilableData,                   foundedClass,selectedOption1,selectedOption2){

  **How to merge these veh_register+noofpass+avilableData+...........**
     Into single Scope that send it from here to Target .........

   $http.post("interface.php?action=sendVehRegDetails").then(function(result) {                 
           $scope.year=result['data'];
     });
 }

1 个答案:

答案 0 :(得分:1)

您可以在Angular中使用extend函数:

https://docs.angularjs.org/api/ng/function/angular.extend

  

通过复制所有属性来扩展目标对象dst   从src对象到dst。您可以指定多个src对象。