$ Scope extension in Angular.js

Sometimes I see people using this template:

angular.extend($scope, {somekey, someval}).

What is the advantage of using this scope extension style when I can set the scope directly like this:

$scope.somekey = someval?

+4
source share
1 answer

What is the advantage of using this extension style?

If I read this correctly , there’s absolutely nothing, despite the syntactic pseudo-sugar with which I personally disagree.

Although, after reading some angular-leaflet issues , I once remember that I read someone, stating that something worked with angular.extendand didn’t have a simple purpose.

+1

Source: https://habr.com/ru/post/1584362/


All Articles