Skip to content

Instantly share code, notes, and snippets.

@allthesignals
Last active July 12, 2016 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allthesignals/90ccd6033a6531c52adb110ab3f6b272 to your computer and use it in GitHub Desktop.
Save allthesignals/90ccd6033a6531c52adb110ab3f6b272 to your computer and use it in GitHub Desktop.
Ember Challenge Ranges
import Ember from 'ember';
export default Ember.Component.extend({
// This component is designed to take any range,
// an area of variation between upper and lower
// limits on a particular scale, and distill into
// min/max variables
// This component needs to take a string
// that can be parsed into an array
// such as "[1,20]" and bind/convert
// respective min/max values
// input values
from: function() {
}.property('range'),
to: function() {
}.property('range'),
_resetProperty: function() {
}.observes('from', 'to'),
// helpers
_toArray: function(full_range) {
return JSON.parse(full_range);
},
_toString: function(from,to) {
return '[' + from + ',' + to + ']';
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
queryParams: ['range'],
appName: 'MAPC Ember Challenge',
range: '[1,20]'
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
QueryParams:
{{range}}
{{range-component range=range}}
<br>
<br>
{{yield}}
To: {{input type="text" value=min}} <br/>
From: {{input type="text" value=max}} <br />
<br />
Computed Range: {{range}} <br/>
Type: {{typeof}}
{
"version": "0.10.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.6.0",
"ember-data": "2.6.1",
"ember-template-compiler": "2.6.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment