Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJs : How to merge two or more scope into single scope

Actually am sending the data from registration form with multiple scopes ie (veh_register,noofpass,avilableData,foundedClass).......

Every scope object has data like veh_register :{ "vin" : vin89, "vplnum" :AR 890S, "uni" :proxu} noofpass : { noofpass : 900} availableData : {"Class" : 9009, "name" : manish} etc...... like that

Then how to combine them as single scope object to send it over $http.Post

Here is Clear Cut Code .........

Controller Method In AngularJs

$scope.vechicle_Register=function(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'];
     });
 }
like image 891
user1153130 Avatar asked Dec 20 '25 23:12

user1153130


1 Answers

You can use the extend function in Angular:

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

Extends the destination object dst by copying all of the properties from the src object(s) to dst. You can specify multiple src objects.

like image 103
Danny Kopping Avatar answered Dec 22 '25 16:12

Danny Kopping



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!