Implementing the Modal Functionality
Learn how to add a DOM element for our modal window and how to add/change the title to the modal view.
We'll cover the following...
We'll cover the following...
So far, we have implemented a modal view but haven’t added any functionality to it.
DOM element
If we want to display modal windows, we’ll need a region to show them. Let’s add a DOM element for our modal dialogs in the following code in line 7:
We also need Marionette to configure this new DOM element as a region within our application:
Display on click
Let’s display our edit form in a modal window when the user clicks the edit link in our List view:
We reuse our Edit.Contact view from the Edit submodule and display it within a modal. This is achieved by calling jQuery UI’s dialog method on the view’s element. Take a look at how this behavior is organized: ...