Created
October 30, 2019 02:51
-
-
Save balvig/357f6600e51045810015c47724e9c9aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- layouts/application.html.erb --> | |
<div data-controller="modal"> | |
<%= link_to "Get Started", new_authentication_path, data-action="modal#show" %> | |
<div data-target="modal.dialog"></div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class extends Controller { | |
static targets = ["dialog"] | |
show(event) { | |
fetch(event.currentTarget.href).then(data => { | |
this.dialogTarget.innerHTML = data; | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment