Reputation: 48490
I'm inspecting the DOM on an Angular application and trying to figure out how I can reproduce one of the events that's bound to a button via the console. The button looks like this:
<button class="button tiny text player-add-button" ng-class="{ 'player-add-button': !player.inLineup, 'player-remove-button': player.inLineup }" ng-click="player.inLineup ? draft.rosterRemove(player) : draft.rosterAdd(player)">
What I'm trying to access here is draft.rosterAdd()
. The problem is, this is a table, and there's multiple buttons and player
is changing for every button. I'm not entirely sure how to define player here, even if I get into the scope of of the draft object, to pass it in as an argument to rosterAdd()
What's the best way to figure out how I can define player
so that I can invoke draft.rosterAdd(player)
for all of the players I want to add via the console?
Upvotes: 0
Views: 64
Reputation: 14114
Try this (in Chrome):
draft = angular.element($0).scope().draft
;player = angular.element($0).scope().player
.Now you should be able to see how player
is structured and call draft.roasterAdd()
passing whatever you want.
Some useful references about the code above:
Upvotes: 1