Reputation: 211
angular.extend($scope.postConfig, $scope.channelConfig, {
scrollTop: 0
});
Is it correct way to extend 2 objects at once?
Upvotes: 0
Views: 582
Reputation: 11963
As it said in AngularJS docs :
angular.extend
Extends the destination object
dst
by copying own enumerable properties from thesrc
object(s) todst
. You CAN SPECIFY MULTIPLE SRC OBJECTS.
Usage: angular.extend(dst, src1, src2, ...);
Your syntax is correct.
Upvotes: 0
Reputation: 7911
Yes, as mentioned in the angular.extend
docs,
Extends the destination object dst by copying own enumerable properties from the src object(s) to dst. You can specify multiple src objects.
So, what you have in the question is correct syntax:
angular.extend($scope.postConfig, $scope.channelConfig, {
scrollTop: 0
});
Just make sure that first argument is the destination object which will get extended by the (multiple) source object(s) provided as next arguments.
Upvotes: 2