mardi 7 février 2017

How can i change the attribute of a field in Ember JS from a route

In My application i have a template file with 2 fields(say name1 / name2). Based on one parameter("preference") in the route i want to display either Recipe1 or Recipe2 on the screen. For eg: if preference is veg, i should display Recipe1 else Recipe2. i tried this as below but it did not work.

 export default Ember.Route.extend({
 beforeModel(){
 if (preference==='veg'){
     console.log("Inside Veg..");
     Ember.$("#Recipe2").attr("type","hidden");
 }
 else {
     console.log("Inside Non Veg..");
     Ember.$("#Recipe1").attr("type","hidden");
 }

What i see is that it goes inside the if/else loop but the ember.$ statements dont make any difference.Please help.




Aucun commentaire:

Enregistrer un commentaire