Reputation: 87
So I've got a json file from which I outputed the list of contacts in the table. Each row has a button to click on to proceed to the modal window with that particular row you've clicked on. I handled the window but I can't figure out how do I pass that data to the modal window.
Upvotes: 0
Views: 54
Reputation: 21694
If you're using bootstrap UI, you can add it as a resolve
entry:
yourItems = [...];
$uibModal.open({
...
controller: 'MyModalCtrl as modal',
resolve: {
modalItems: function() {
return yourItems;
}
}
})
And inject it into your controller like so:
angular.module('myApp').controller('MyModalCtrl', function(yourItems) {
...
});
Upvotes: 2
Reputation: 129
I'm not exactly sure how you're project is set up, but there are two libraries that I recommend for creating modals easily.
ngDialog and ui-bootstrap
Both of these have simple methods for attaching data and controllers to dialogs as well as creating your own templates and styles for them.
Upvotes: 0