Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4838

Load results from database in select box onchange event

$
0
0

@mahaniff wrote:

hi guys

Can anyone guide me how to load data from database when i change the value on the select box? i came up with a solution but its not working.

my component.js

actions:{
filterStudent(){
let filterInputValue = this.get('value');
console.log(filterInputValue);
let filterAction = this.get('filter');
console.log(filterAction);
}
},

my component hbs file


Please Select
{{#each model.Students as |newStudents|}}
{{newStudents.studentName}}
{{/each}}

my Controller

actions: {
filterStudentResults(param)
{
if (param !== '')
{
return this.get('store').query('Students', { studentName: param });
}
else
{
return this.get('store').findAll('Students');
}
}
}
});

am caliing the component in the template as follows

{{bind-dropdown model=model Filter=filterStudentResults}}

Am a newbie to EmberJS and appreciate any help. Thanks in Advance :slight_smile:

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4838

Trending Articles