Angular 5 simple questions

hello im working with ankular and
have this expression
return this.color=== itemyellow ? this.item="yellow" : etx
how do i put two possible outcomes like so
itemyellow or itemred?

And also a question about i have this

((li class="nav-item active" [ngClass]="{'active': 'selectedItem == item'}" (click)="listClick($event, item)" *ngFor="let item of items">

how do i make the selected item green? the active “item” that is
aniways thanks for ani help/

Angular 5…

I’m not sure about the questions, anyway as far as i can see :

return this.color=== itemyellow ? this.item="yellow" : etx
how do i put two possible outcomes like so
itemyellow or itemred?

This snippet works ( parenthesis added for sake of clarity)

let color, itemRed, itemYellow;
color = itemRed;
color === (itemYellow || itemRed) ? item = "yellow" : item = "red";
console.log(item);    // yellow

how do i make the selected item green? the active “item” that is

If i read it correctly you’re assigning the ‘.active’ class to the element “li” when “selectedItem == item”; that said, to make the element green just work on the ‘.active’ css class ^^

Hope it helps^^

hello.
I tried ur solution alot to see if works and i cant get it to work.
Do u know if || marker really works?
it still only selects one outcome for me.
i also thought it work but ye.
Do you have any clue

Mh…i just copy pasted that code into codepen here and it works fine ^^
At the moment i can’t test it into angular ( i detonated windows this morning, still setting up my brand new Debian copy :D) but i can’t imagine why it shoudn’t ( here typescript operators )

Hope it helps^^