1

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

2 Answers 2

2

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

Sign up to request clarification or add additional context in comments.

Comments

1

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).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.