Im trying to learn Andgular and IONIC framework. But now I dont know how to make condition like this:
if (price = false) {
echo 'No price';
}
Now I have this code in IONIC
<h2 style="font-size:15px;margin:0 0 4px">{{item.name}}</h2>
<h3 style="color:red;" *ngIf="!item.special;"> {{item.price}}</h3>
<h3 color="primary" *ngIf="item.special"><del>{{item.price}}</del></h3>
<h3 color="danger" *ngIf="item.special"> {{item.special}}</h3>
<p style="margin:3px 0 6px">{{item.description}}</p>
If you want just show info about no price in your html you should use:
<h3 *ngIf="!item.price">No price</h3>
Use angular way with ternary operator.
<h3>{{!item.price ?'No price':item.price}}</h3>
Another way:
<ng-container *ngIf="item.price">
No price
</ng-container>
It's better because ng-container doesn't exists in DOM.
If you want to check in .ts file,
if(!price){
console.log("false")
}
or
if(price==false){
console.log("false)
}
if you want to check in HTML file,
<h3 *ngIf="!price">{{ price }}</h3>