angularjs - How should i pass $scope value to function in haml template -


i using haml templates angular js. while template rendering want create function call on div using ng-click. working fine without parameter when passing parameter function behaving below 2 cases.

%div.sitescontainer   .wrapper     %div.site{"ng-repeat"=>"site in sites",'ng-click'=>"siteblockclick({{site.id}})"}       %span         {{site.name}} 

then giving me error syntax error: token 'site.id' unexpected inspect div showing ng-click="siteblockclick(bwn)" means value coming single quotes missing.

%div.sitescontainer   .wrapper     %div.site{"ng-repeat"=>"site in sites",'ng-click'=>"siteblockclick('{{site.id}}')"}       %span         {{site.name}} 

if given single quotes printing making call ng-click="siteblockclick('{{site.id}}')"

how should concat work me ?

i want ng-click="siteblockclick('bwn') after inspect

any appreciated.

inside ng-click, don't need interpolate (use {{ }}.

so, should work you:

%div.sitescontainer   .wrapper     %div.site{"ng-repeat"=>"site in sites",'ng-click'=>"siteblockclick(site.id)"}       %span         {{site.name}} 

the ng-repeat creates each site in scope , ng-click accesses scope directly.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -