【发布时间】:2016-09-16 15:45:20
【问题描述】:
我有一张表格,里面填满了数据库中的信息。它还有一个提交按钮。如果该行上的人遵守我签入控制器的某个条件,则不应出现该按钮。我该怎么做?
我尝试设置一个返回 true 或 false 的函数,但该函数将持续运行并导致我的程序崩溃。我还尝试将该功能设置为每隔一段时间运行一次,但它并没有改变按钮。问题是我认为一开始,当我加载页面时,客户端无法从表中获取任何信息,它总是未定义。
代码html:
<form>
<table class="table table-hover">
<thead>
<tr>
<th>Id</th>
<th>Status</th>
<th>Location</th>
<th>Start</th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="interview in $ctrl.pendingInterviews">
<td>{{ interview.id }}</td>
<td>{{ interview.status }}</td>
<td>{{ interview.location }}</td>
<td>{{ interview.start | date:'medium' }}</td>
<td><input type="submit" name="Submit" id="submit" ng-hide="varDiv" ng-click="varDiv = true; $ctrl.addParticipant(interview.id)"></td>
</tr>
</tbody>
</table></form>
现在点击后它就消失了,这是不行的,因为当我重新加载时,它又出现了。
this.checkIfAdded = function checkParticipant(interviewId) {
var participant={
username:"mama",
interviewId:interviewId
};
return Interview.checkIfAdded(JSON.stringify(participant))
.then(
function (errResponse) {
console.error('Error while fetching pending interviews');
}
);
}
我认为这将根据从 Interview.checkIfAdded 获得的信息返回 true 或 false。
【问题讨论】:
标签: javascript html angularjs