akoenig / angular-deckgrid

A lightweight masonry-like grid for AngularJS.
http://akoenig.github.io/angular-deckgrid
MIT License
1.1k stars 191 forks source link

How to pass current card info to controller #70

Closed Neway6655 closed 9 years ago

Neway6655 commented 9 years ago

i am new to angularJS, and i am wonder if i can get the current selected card info in my controller, here is my scripts: <div class="deckgrid" deckgrid source="books" cardTemplate="templates/deckgrid-card.html"></div>

and in templates/deckgrid-card.html file, i want to pass the current clicked card's info to my controller, <a href="" data-ng-click="mother.showBookDetail({{card.title}})">

and in my controller, i have the function showBookDetail defined: $scope.showBookDetail = function(title) { alert(title) };

and i can not get the value of card.title, but always the string of 'card.title'.

Thanks.

Neway6655 commented 9 years ago

Sorry, i have figured it out, i need to use: <a href="" data-ng-click="mother.showBookDetail(card.title)"> close it.