Reputation: 1171
new to angularjs. ive got a list of players. What i want to do is when click on a player I want to be able to create an overlay modal with that specific players details. I think i have to use a directive but not sure how I can populate the modal with the correct player data...
If any one can point me the right direction that would be great..
Thanks
Upvotes: 1
Views: 1963
Reputation: 9780
I am assuming you wanted this,
In controller:
$scope.players = [{name: 'sss'}, {name: 'aaa'}]; //array of players
$scope.select = function (index) {
$scope.selectedPlayer = $scope.players[index];
}
In template:
<div ng-repeat='player in players'>
<div ng-click='select($index)'>{{player.name}}</div>
</div>
When you click on the player in the view you will get the player object in $scope.selectedPlayer
modal
Upvotes: 2
Reputation: 3726
Take a look at angular-ui/ui-bootstrap.
It has a lot of the DOM manipulating components you are used to working with between JQueryUI and Twitter bootstrap already created as directives (including modals).
Upvotes: 1