I do have a controller that has an action {{loadRight}} that passes the current model to the controller when I click a button.
When I first load the app, I also use firstElement computed property which pulls the first element from my model array.
Basically what I want to do is create a second computed property which would return the current model that's clicked so that I can use this information in my template.
I created a currentElement computed property however since I suck at javascript I couldn't pass the current model from action method to the computed property. I keep getting model is not defined error.
I would appreciate any help. Below is my controller.
// controller works.js
import Ember from "ember";
export default Ember.Controller.extend({
firstElement: function () {
return this.get('model.firstObject');
}.property('model.[]'),
currentElement: function () {
if(!currentModel) {
currentModel = this.get('model.firstObject');
}
return currentModel;
}.property('model.[]'),
actions: {
loadRight: function (currentElement) {
console.log(currentElement);
}
}});