0

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.

2

2 Answers 2

2

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) {
    ...
});
Sign up to request clarification or add additional context in comments.

Comments

0

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.

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.