lundi 27 novembre 2017

ember inline if else statement

I'm using Ember JS and i'm having a weird problem neither the documentation of ember nor the truth helper docs helped me to figure it out

Simple problem but driving me crazy, i want to write an inline "if" statement with "else" clause but it won't work

Here is my code

<option class="form-control" value="" selected=">

The "if" statement in the value attribute is working just fine the problem is in the selected attribute, here is the dilemma.

I'm optimizing my code so i wrote a component with foreach loop but the foreach could iterate from either a service i written for some hardcoded data or some data from the database so if serviceList is true that means that the data is coming from the service not the database which in case wouldn't deal with "id's", so i want my inline "if" statement to check wether if serviceList is true or not, if serviceList is true then check if the item from the service equals the value from the database and display the current value in the edit from, else if serviceList is false then check if the item.id equals a value already stored in the database and display it.

Thanks for help in advance.




Aucun commentaire:

Enregistrer un commentaire