0
angular.extend($scope.postConfig, $scope.channelConfig, {
        scrollTop: 0
    });

Is it correct way to extend 2 objects at once?

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Yeah sure. Meanwhile it would be helpful if you upvote my ques :)
0

As it said in AngularJS docs :

angular.extend

Extends the destination object dst by copying own enumerable properties from the src object(s) to dst. You CAN SPECIFY MULTIPLE SRC OBJECTS.

Usage: angular.extend(dst, src1, src2, ...);

Your syntax is correct.

3 Comments

Thank you for your help.
You're welcome! It would be nice of you to accept the answer ;)
Yeah sure. Meanwhile it would be helpful if you upvote my ques :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.