Home passing a parameter to a service using ngclick AngularJS

# passing a parameter to a service using ngclick AngularJS

Aneta Jabłońska
1#
Aneta Jabłońska Published in 2017-11-14 18:12:23Z
 Hey I have array of numbers, I am writing them using ng-repeat. When you click on some number should be pass to function passParameterToService parameter index and should be saved in service to variable this.whichBoard. But I have do something wrong, can someone tell me why ng-repeat don't work when I add service and why after click on some number, it's dont write to a variable? demo  https://codepen.io/Turqus/pen/WXEryN
rrd
2#
 In your service you were declaring this.whichBoard but inside the function you again used the same named variable. If you set this.board inside, it would probably work: app.service('serwis', ()=> { this.whichBoard = (index) => { this.board = index; }; });  Also in the calling method, you have:  {{item}}  You're passing \$index, which isn't a value. Also, you have the repeat inside the method call, so change it to: