Front End Developer (AngularJS) Question:

Download Job Interview Questions and Answers PDF

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

Front End Developer (AngularJS) Interview Question
Front End Developer (AngularJS) Interview Question

Answer:

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>

Download Front End Developer (AngularJS) Interview Questions And Answers PDF

Previous QuestionNext Question
What is AngularJS? What are the key features of AngularJS? Is there any down-side of using AngularJS?Tell me do I need to worry about security holes in AngularJS?