angular-360-no-scope icon indicating copy to clipboard operation
angular-360-no-scope copied to clipboard

Add $watchGroup

Open gabrielmaldi opened this issue 9 years ago • 4 comments

A feature request very similar to #4 but for $watchGroup.

Thanks!

gabrielmaldi avatar Mar 14 '16 19:03 gabrielmaldi

Hey I was need also such behavior, and as I see its development is not in progress. Thus, here my solution for this issue:

ctrlImpl.prototype.$watchGroup = function () {
         var args = arguments, watchExpr = args[0];     
         watchExpr.forEach(function (item,index,array) {
             var getExpr = $parse(item);
             array[index] = function () { return getExpr(instance); }
         });
         return $scope.$watchGroup.apply($scope, args);          
     }

Just add it inside angular-360-no-scope.js file after $watch prototype overriding. Hope this helps

sashberd avatar Nov 30 '16 09:11 sashberd

Thank you, @sashberd!

gabrielmaldi avatar Nov 30 '16 14:11 gabrielmaldi

Put this in a PR and I'll merge it!

christopherthielen avatar Nov 30 '16 22:11 christopherthielen

I have no idea how to put this to PR so I leave this to you

sashberd avatar Dec 01 '16 06:12 sashberd