Html 如何在Angularjs中删除CSS样式使用条件?
我正在使用Html 如何在Angularjs中删除CSS样式使用条件?,html,css,angularjs,Html,Css,Angularjs,我正在使用ng repeat以表格行格式显示教育详情,如下所示,每行用边框底部分割:1px solid#337AB7样式 <div class="well row table-responsive" > <form name="eForm" role="form" novalidate> <div ng-repeat="data in blobObjEducation" ng-hide="profileFilled==false;">
ng repeat
以表格行格式显示教育详情,如下所示,每行用边框底部分割:1px solid#337AB7代码>样式
<div class="well row table-responsive" >
<form name="eForm" role="form" novalidate>
<div ng-repeat="data in blobObjEducation" ng-hide="profileFilled==false;">
<table class="table table-hover dataTable col-sm-8" >
<tr ng-show="!eEditMode[$index]">
<td class = "col-sm-6 editstyle" ng-if="!data.yoj && !yoc || !data.university ||!data.qualification && !data.specialization"><b>Enter Education details below</b></td>
<td class ="col-sm-6" ng-show="data.yoj && data.institute &&(data.qualification || data.qualificationTxt) && (data.specialization || data.specializationTxt) && data.yoc">
<b id="universitytitle">{{data.institute}}</b>
<br><br>
<b class="sizefortitle">
{{data.qualification}}
{{data.specialization}}<b class ="sizefortitle"></b> {{data.yoj}} To {{data.yoc}}</b> </td>
<td ng-show="editIconDisplay[$index]" class = "col-sm-1 editstyle pull-left" id ="editId" ng-click="edit('education', $index);"><a aria-hidden="true"><span class="pull-right glyphicon glyphicon-pencil" data-toggle ="tooltip" title="Edit your Qualification" data-placement ="top"></span></a></td>
</tr>
</table>
<style>
.dataTable{
border-bottom: 1px solid #337AB7;
border-spacing: 5px;
border-collapse: separate;
}
</style>
在下面输入教育详细信息
{{data.institute}
{{data.qualification}
{{data.specialization}{{data.yoj}}到{data.yoc}
.数据表{
边框底部:1px实心#337AB7;
边界间距:5px;
边界塌陷:分离;
}
我使用的条件是,如果字段值为空,则该行将显示为“输入教育详细信息”,编辑图标位于右上角(如下图所示)
我不需要显示任何消息,编辑图标和css边框底部
使用ng class
class指令,以便您可以为类添加条件。
试试这个:-
使用ng class=“dataTable:fieldValues!==null”
在这里
dataTable
:-是您的类名,
fieldValues
:-是基于您必须添加条件的对象。
并检查是否为空或未定义。并相应增加条件
在您的情况下,请尝试以下操作:-
// if following is your condition then add like below, it just an example, you can add there proper condition.
"<td ng-class="'editstyle': !data.yoj && !yoc || !data.university ||!data.qualification && !data.specialization" ng-if="!data.yoj && !yoc || !data.university ||!data.qualification && !data.specialization"><b>Enter Education details below</b></td>"
//如果下面是您的条件,那么像下面这样添加,这只是一个示例,您可以在那里添加适当的条件。
“在下面输入教育详细信息”
使用ng class
class指令,以便您可以为类添加条件。
试试这个:-
使用ng class=“dataTable:fieldValues!==null”
在这里
dataTable
:-是您的类名,
fieldValues
:-是基于您必须添加条件的对象。
并检查是否为空或未定义。并相应增加条件
在您的情况下,请尝试以下操作:-
// if following is your condition then add like below, it just an example, you can add there proper condition.
"<td ng-class="'editstyle': !data.yoj && !yoc || !data.university ||!data.qualification && !data.specialization" ng-if="!data.yoj && !yoc || !data.university ||!data.qualification && !data.specialization"><b>Enter Education details below</b></td>"
//如果下面是您的条件,那么像下面这样添加,这只是一个示例,您可以在那里添加适当的条件。
“在下面输入教育详细信息”
您可以使用ng class
@kalai哪个对象显示您的字段值,那么您确定该对象为空的依据是什么?请在下面输入教育详细信息您可以使用ng class
@kalai哪个对象显示您的字段值,那么,您决定对象为空的依据是什么?请在下面输入教育详细信息。请告诉我您必须在哪个变量基础上添加条件,这样我将相应地更新答案。如果字段值为空,则它将考虑“在下面输入教育详细信息”并显示“输入教育详细信息”的条件如上图所示,editicon位于右上角。但我不需要显示此消息,editicon仅用于此条件,并且需要隐藏边框底部css样式。我是angularjsyes的新手,但请告诉我变量、对象或条件,因为你必须隐藏和显示你的类?你必须在ng类中添加该条件的条件是什么?
directive我在错误“angular.js:9997 error:[$parse:syntax]语法错误:标记“:”是表达式[editstyle:!data.yoj&!yoc|||!data.university||!data.qualification&&!data.specialization]第10列的意外标记,起始于[:!data.yoj&!yoc|||!data.university|||!data.qualification&!data.specialization]。”它只需非常清楚地编写条件即可工作,例如:-1)类需要被引用(“”),2)避免!data.yoj
尝试添加类似的data.yoj!='null“| |”undefined”
,在条件再次使用我提到的引号后,请告诉我您必须在哪个变量基础上添加条件,因此我将相应地更新答案。如果字段值为空,则它将考虑条件“在下面输入教育详细信息”并显示“输入教育详细信息”如上图所示,editicon位于右上角。但我不需要显示此消息,editicon仅用于此条件,并且需要隐藏边框底部css样式。我是angularjsyes的新手,但请告诉我变量、对象或条件,因为你必须隐藏和显示你的类?你必须在ng类中添加该条件的条件是什么?
directive我在错误“angular.js:9997 error:[$parse:syntax]语法错误:标记“:”是表达式[editstyle:!data.yoj&!yoc|||!data.university||!data.qualification&&!data.specialization]第10列的意外标记,起始于[:!data.yoj&!yoc|||!data.university|||!data.qualification&!data.specialization]。”它只需非常清楚地编写条件即可工作,例如:-1)类需要被引用(“”),2)避免!data.yoj
尝试添加类似的data.yoj!='null“| |”undefined”
,在条件之后再次使用我提到的引号