Skip to content

Instantly share code, notes, and snippets.

@kumkanillam
Last active May 26, 2016 06:31
Show Gist options
  • Save kumkanillam/c01f30b15c04e6041df94b68648c762e to your computer and use it in GitHub Desktop.
Save kumkanillam/c01f30b15c04e6041df94b68648c762e to your computer and use it in GitHub Desktop.
Ember view Select
import Ember from 'ember';
export default Ember.Component.extend({
max_attemptintervalvalue:[1,2,3,4,5],
max_attempt_disabled:false,
attempt_countvalue:[1,2,3,4],
selectedVal:3,
selectedCountVal:1,
didInsertElement(){
this._super(...arguments);
var _this = this;
$('select[name=max_attempt_count]').on('change',function(){
if(this.value == 1)
{
_this.set('max_attempt_disabled',true);
}
else
{
_this.set('max_attempt_disabled',false);
}
}).change();
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
<h1>Welcome to {{appName}}</h1>
<br>
{{select-demo }}
<br>
{{outlet}}
<br>
<br>
<div> max_attemptinterval</div>
{{view "select" name="attempt_interval" disabled=max_attempt_disabled content=max_attemptintervalvalue value=selectedVal}}
<div> attempt_count</div>
{{view "select" name="max_attempt_count" content=attempt_countvalue value=selectedCountVal }}
{{yield}}
{
"version": "0.8.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": "1.13.13",
"ember-data": "2.5.2",
"ember-template-compiler": "1.13.13"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment