Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS Print Yes or No based on boolean value

Tags:

angularjs

I'm getting Bool value from database to angularJs

<td>
    {{patient.Alcoholic}}
</td>

instead of false or ture i need to print YES or NO

<td>
    {{patient.Alcoholic // can i have if-else condition over here ??}}
</td>
like image 555
Arjun Avatar asked Jul 13 '15 10:07

Arjun


People also ask

How do you set a boolean to yes or no?

To convert a boolean value to Yes/No, use a ternary operator and conditionally check if the boolean value is equal to true , if it is, return yes , otherwise return no , e.g. bool === true ?

Can boolean values be yes no?

Use the Yes/No data type to store a Boolean value, such as True or False, On or Off, Yes or No, and any field that contains only one of two values.

Is yes and no boolean in JavaScript?

In JavaScript, a boolean value is one that can either be TRUE or FALSE. If you need to know “yes” or “no” about something, then you would want to use the boolean function. It sounds extremely simple, but booleans are used all the time in JavaScript programming, and they are extremely useful.

Is bool true 1 or 0?

Boolean values and operationsConstant true is 1 and constant false is 0. It is considered good practice, though, to write true and false in your program for boolean values rather than 1 and 0. The following table shows comparisons and boolean operations.


1 Answers

<td>
 {{true == patient.Alcoholic ? 'Yes' : 'No' }}
</td>

This should work!

like image 160
Coder John Avatar answered Sep 29 '22 20:09

Coder John