Hi Sander, it did not work for me. $scope was not reachable in ng-repeated directive scope so I could not do anything to it in ng-repeated directive. I try to create a value of element's computed properties so it must be done inside the ng-repeated directory. I had no access to $scope there. I tried your way and wi value was not displayed:
plnkr <http://plnkr.co/edit/Sxq0uQ4vAZhEVDxbudoE?p=preview> <!DOCTYPE html> <html> <body> <div ng-app="app" ng-controller="test"> <i ng-repeat = "null in [1,2,0]" give-w>abc<br></i> <br>{{ holder.wi }} </div> <script src="https://code.angularjs.org/1.3.6/angular.js"></script> <script> console.clear(); app = angular.module('app', []); app.controller('test', function($scope) {}); var directives = {}; directives.giveW = [ function() { return { link: function(scope, element, attrs) { scope.holder = {wi: 5}; } } } ]; app.directive(directives); </script> </body> </html> Thank you for your answer. W dniu sobota, 20 grudnia 2014 18:16:15 UTC+1 użytkownik Sander Elias napisał: > > Hi trzczy, > > This has to do with how inheritance works in JS If you put a dot in the > name, it will work as you expect. > > in stead of $scope.wi, do something like $scope.holder={wi: 5} > then use holder.wi where ever you need it in your template. > > Want to know more, search this list-group for ‘the dot rule’ > > Regards > Sander > > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
