daydreamer
daydreamer

Reputation: 92139

AngualrJS: How to I pass the data to bootstrap modal?

Here is the plunker - http://plnkr.co/edit/iwvjJcUurUW2AvkDArfz?p=preview

I am using Modal from http://mgcrea.github.io/angular-strap/

I want to pass the transaction-id to delete function, how is this achievable using AngularJS?

Thank you

Upvotes: 1

Views: 1766

Answers (1)

lucuma
lucuma

Reputation: 18339

On the ng-click of the modal's delete button:

ng-click="modal.saved=true;delete(transaction.id);hide()"

Delete function:

 $scope.delete = function(id) {
   alert(id);
  }

Working plunkr: http://plnkr.co/edit/lzKAjCyIySoz45r56YjL?p=preview

I believe the strap inherits the current scope so you just pass in the transaction id (or you could pass in the entire transaction object) to the delete function.

Upvotes: 2

Related Questions