Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs ng样式不适用于布尔in<;的原因是什么;td>;?_Angularjs - Fatal编程技术网

Angularjs ng样式不适用于布尔in<;的原因是什么;td>;?

Angularjs ng样式不适用于布尔in<;的原因是什么;td>;?,angularjs,Angularjs,尝试了以下标记: `<td ng-style="isTrue && {'background-color':'yellow'}">` ` 如果单元格值为true,但代码不起作用,我将尝试以黄色突出显示。原因可能是什么 请记住,ng样式是AngularJS属性。你应该这样做: angular.module('app',[]).controller('myctrl',function($scope){ $scope.isTrue=true; }); div[

尝试了以下标记:

  `<td ng-style="isTrue && {'background-color':'yellow'}">`  
`

如果单元格值为true,但代码不起作用,我将尝试以黄色突出显示。原因可能是什么

请记住,ng样式是AngularJS属性。你应该这样做:

angular.module('app',[]).controller('myctrl',function($scope){
$scope.isTrue=true;
});
div[ng样式]{
宽度:150px;
高度:150像素;
}


HTML中没有
ng style
属性。如果你使用的是angular,那么把你的问题标记为angular。使用类似的方法。。但不适用于Booleanng样式,因为它的模型类似于{'property':'value'}。就像我那样,是吗?”黄色“:“红色”表达式将根据isTrue值返回“黄色”或“红色”。“背景色”将得到表达式的结果。谢谢。我只是错过了一些东西