Explain Me How Will You Display Different Images Based On The Status Being Red, Amber, Or Green?
Answers

Question and Answer:

  Home  Front End Developer (AngularJS)

⟩ Explain me how will you display different images based on the status being red, amber, or green?

Use the ng-switch and ng-switch-when directives as shown below.

<div ng-switch on="account.status">

<div ng-switch-when="AMBER">

<img class="statusIcon"

src='apps/dashboard/amber-dot.jpg' />

</div>

<div ng-switch-when="GREEN">

<img class="statusIcon"

src='apps/dashboard/green-dot.jpg' />

</div>

<div ng-switch-when="RED">

<img class="statusIcon"

src='apps/dashboard/red-dot.jpg' />

</div>

</div>

 194 views

More Questions for you: