Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/25.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
Css ng show未在div上与班级一起工作_Css_Angularjs - Fatal编程技术网

Css ng show未在div上与班级一起工作

Css ng show未在div上与班级一起工作,css,angularjs,Css,Angularjs,现在,我有 <div class="error-msg" ng-show="displayError()">Error Messages: {{error}}</div> 在将类保留在div上的同时,我执行ng show的正确方法是什么?您只需要从css规则中删除display:none。如果displayError返回false,ng show将对具有display:none(使用!important强制覆盖任何其他显示:块或其他显示属性)的元素应用ng hide类,

现在,我有

<div class="error-msg" ng-show="displayError()">Error Messages: {{error}}</div>

在将类保留在div上的同时,我执行ng show的正确方法是什么?

您只需要从css规则中删除
display:none
。如果displayError返回false,ng show将对具有
display:none
(使用
!important
强制覆盖任何其他显示:块或其他显示属性)的元素应用
ng hide
类,否则它将依赖于您提供的规则并将其隐藏在那里(因此它不会显示)


display:none
可能会给您提示。
.error-msg {
height: 40px;
overflow: auto;
display: none;
margin-bottom: 10px;
}
.error-msg {
  height: 40px;
  overflow: auto;
  margin-bottom: 10px;
}