【问题标题】:AngularJs : How to merge two or more scope into single scopeAngularJs:如何将两个或多个范围合并为单个范围
【发布时间】:2014-06-21 20:02:29
【问题描述】:

实际上是从具有多个范围的注册表单发送数据,即(veh_register,noofpass,avilableData,foundedClass)......

每个作用域对象都有类似的数据 veh_register:{“vin”:vin89,“vplnum”:AR 890S,“uni”:proxu} noofpass : { noofpass : 900} 可用数据:{“类”:9009,“名称”:manish} 等等……这样的

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

这是清晰的代码............

AngularJs 中的控制器方法

$scope.vechicle_Register=function(veh_register,noofpass,availableData, 建立类,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'];
     });
 }

【问题讨论】:

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


    【解决方案1】:

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

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

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

    【讨论】:

    • 是否可以将多个源范围扩展到单个目标
    • 这工作谢谢!!
    猜你喜欢
    • 1970-01-01
    • 2019-03-21
    • 2021-02-24
    • 2015-05-26
    • 2015-05-26
    • 2022-11-03
    • 1970-01-01
    • 2013-04-15
    • 2015-01-23
    相关资源
    最近更新 更多