Skip to content

Instantly share code, notes, and snippets.

@dylankb
Last active March 28, 2017 00:28
Show Gist options
  • Save dylankb/279e0b19b3322683546327657ef3d0e1 to your computer and use it in GitHub Desktop.
Save dylankb/279e0b19b3322683546327657ef3d0e1 to your computer and use it in GitHub Desktop.
Modal example
import Ember from 'ember';
export default Ember.Controller.extend({
isShowingForm: false,
actions: {
toggleModal() {
this.toggleProperty('isShowingForm');
}
}
});
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: config.locationType,
rootURL: config.rootURL
});
Router.map(function() {
this.route('users');
});
export default Router;
<h1>A Basic Form</h1>
{{outlet}}
{{users}}
<button {{action "toggleModal"}}>
Edit User Info
</button>
{{#if isShowingForm}}
<p>User info</p>
<form method="patch">
<div>
<label>Full Name</label>
{{input value=fullName placeholder=model.fullName}}
</div>
<div>
<label>Nickname</label>
{{input value=nickname placeholder=model.nickname}}
</div>
</form>
{{/if}}
{
"version": "0.12.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.12.0",
"ember-template-compiler": "2.12.0",
"ember-testing": "2.12.0"
},
"addons": {
"ember-data": "2.12.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment