简体   繁体   中英

How to make equalization in ng-if? ( AngularJS )

I have ng-if problem. I want something similar to the php syntax in AngularJS. Example:

<?php 
$A = "Data";
if ( $A == "Data" ) {
$B = "ImData"; 
}
else{
$B = "ImNotData";
}
?>

How to make this syntax in AngularJS ng-if directive?

This does not work:

ng-if="A == 'Data' B='ImData'" 

suppose you have isTrue Boolean variable in controller

In controller:

$scope.isTrue = true;

In View:

<span ng-if="isTrue == "true">TRUE VALUE</span>
<span ng-if="isTrue != "true">OTHER VALUE</span>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM