Last active
February 19, 2017 21:13
-
-
Save tarponjargon/fb1680bfea201aeb4a0d886aafa3eed5 to your computer and use it in GitHub Desktop.
New Twiddle
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
queryParams: ['q','sort_method','search_type','filter1','filter2'], | |
init(){ | |
this._super(...arguments); | |
Ember.set(this, 'q', null); | |
Ember.set(this, 'sort_method', 'relevance'); // <-- sets default value to 'undefined' | |
Ember.set(this, 'filter1', []); // <-- sets default value to 'undefined' | |
}, | |
filter2: [], // <-- sets default value to 'Array[0]' | |
search_type: 'bar', // <-- sets default value properly | |
actions: { | |
addFilter: function(key, value) { | |
alert(`adding "${value.toString()}" to controller property '${key}'`); | |
console.log("DUMP OF EMBER 'this':", this); | |
this[key].pushObject(value.toString()); | |
} | |
} | |
}); |
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
import Ember from 'ember'; | |
import config from './config/environment'; | |
const Router = Ember.Router.extend({ | |
location: 'none', | |
rootURL: config.rootURL | |
}); | |
Router.map(function() { | |
this.route('results'); | |
}); | |
export default Router; |
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
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
queryParams: { | |
q: { refreshModel: true }, | |
sort_method: { refreshModel: true }, | |
search_type: { refreshModel: true }, | |
filter1: { refreshModel: true }, | |
filter2: { refreshModel: true } | |
} | |
}); |
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
{ | |
"version": "0.11.0", | |
"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.10.2", | |
"ember-data": "2.11.0", | |
"ember-template-compiler": "2.10.2", | |
"ember-testing": "2.10.2" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment