I have a table that gets filled with information from the database. It also has a Submit button. If the person on that row respect a certain condition that I check in controller, the button shouldn't appear. How can I do this?
I tried setting up a function that returns true or false but that function will run continuosly and crashes my program. I also tried setting up that function to run at some interval and again, it didn't change the button. The problem is I think that at the begining, when I load the page, the client can't take any information from the table, it always gets undefined.
Code 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>
Right now it just dissapears after I click on it which is not ok because when I reload, it appears again.
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');
}
);
}
this will return true or false I think based on what it gets from Interview.checkIfAdded.