angular-underscore icon indicating copy to clipboard operation
angular-underscore copied to clipboard

Problem with isolated scope

Open RopoMen opened this issue 9 years ago • 3 comments

Methods which are added in to scope are not defined inside isolated scope. I previously had noticed some weird behaviour in "isSomething" methods, but now I was able to point the issue, when I had "range(1, 11)" used in ng-options. (now I know why "isEmpty" for example is not working in all of my views, reason is isolated scope.)

It worked previously when I wasn't using isolated scope, but when I made changes to the directive it stopped working. Finally I was able to narrow down the issue and made jsfiddle https://jsfiddle.net/RopoMen/sprgjnsm/

My own app is using Angular 1.2 series, but this fiddle is using 1.4.

RopoMen avatar Aug 03 '15 12:08 RopoMen

Well, yes. This may not be even possible to do what I googled, but I would start looking for ways to decorate $rootScope and override $new method so that you could add required filter methods over there.

RopoMen avatar Aug 03 '15 12:08 RopoMen

or just alter line 64: function register($rootScope) {$rootScope[methodName] = .bind([methodName], _);}

to

function register($rootScope) {$rootScope.__proto__[methodName] = _.bind(_[methodName], _);}

RopoMen avatar Aug 03 '15 12:08 RopoMen