Skip to content

Instantly share code, notes, and snippets.

@joshuaogle
Forked from jenweber/components.my-component.js
Last active September 25, 2019 17:07
Show Gist options
  • Select an option

  • Save joshuaogle/d2107a68cb41c9d0075dc63736ed2ec8 to your computer and use it in GitHub Desktop.

Select an option

Save joshuaogle/d2107a68cb41c9d0075dc63736ed2ec8 to your computer and use it in GitHub Desktop.
Simple Select
import Ember from 'ember';
export default Ember.Component.extend({
selectedOption: null,
actions: {
setSelection: function(selected) {
this.set('selectedOption', selected)
console.log(this.get('selectedOption'))
},
submit: function(){
// save or sendAction
console.log(this.get('selectedOption'))
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Structure - Tree View',
treeViewData: {
simple: {
1: {
path: "/namespaceA",
label: "namespaceA",
type: "namespace",
children: {
1: {
path: "/namespaceA/ns1",
label: "ns1",
type: "namespace"
},
2: {
path: "/namespaceA/ns2",
label: "ns2",
type: "namespace"
},
}
},
2: {
path: "/namespaceB",
label: "namespaceB",
type: "namespace"
}
},
average: {
},
complex: {
},
deep: {
}
}
});
<h1>Structure Tree View</h1>
{{tree-view}}
{{outlet}}
{
"version": "0.10.6",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "3.4.3",
"ember-data": "3.4.2",
"ember-template-compiler": "3.4.3",
"ember-testing": "3.4.3"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment