WordPress database error: [Can't create/write to file '/tmp/#sql-temptable-4db-61740f-13.MAI' (Errcode: 28 "No space left on device")]SELECT p.* FROM wp_mdb_forum_posts AS p LEFT JOIN wp_mdb_forum_posts AS q ON( q.Id = p.ParentId AND p.Id = q.AcceptedAnswerId ) WHERE p.PostTypeId = 2 AND p.ParentId = 97889 GROUP BY p.Id ORDER BY CASE WHEN q.Id IS NOT NULL THEN 1 ELSE 0 END DESC, p.UpvoteCount DESC, p.CreationDate ASC
Topic: Trying to use switch (with lever) to toggle activate/deactivate function but it is not working
olaniyimoses
pro asked 7 years ago
The code is supposed list the item with lever showing activate or deactivate based on what is saved in the database. and then be able to toggle anyone of the items
the items are are listed but the switch is activated for all items when only one item should be active as saved in the database. Please me, i will really appreciate. thank you
// the html code to list items to toggle
<table class="table-sm" mdbTable>
<thead>
<tr>
<th>Name</th>
<th>Activate</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let season of seasons">
<td>{{ season.Name }}</td>
<td>
<form [formGroup]="form">
<div class="switch primary-switch">
<label>
<input type="checkbox" formControlName="IsActive" />
<span class="lever"></span>
</label>
</div>
</form>
</td>
</tr>
</tbody>
</table>
//the ts file
<table class="table-sm" mdbTable>
<thead>
<tr>
<th>Name</th>
<th>Activate</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let season of seasons">
<td>{{ season.Name }}</td>
<td>
<form [formGroup]="form">
<div class="switch primary-switch">
<label>
<input type="checkbox" formControlName="IsActive" />
<span class="lever"></span>
</label>
</div>
</form>
</td>
</tr>
</tbody>
</table>
// and the service.ts file
getSeasons() {
this.http.get<{message:string, seasons: any}>('http://localhost:3000/api/seasons/')
.pipe(map((seasons) => {
return seasons.seasons.map(season => {
status = season.IsActive ? 'checked' : 'unchecked';
return {
id: season._id,
Name: season.Name,
IsActive: status,
DateCreated: season.DateCreated
};
});
}))
.subscribe((transformedSeasons) => {
this.seasons = transformedSeasons;
console.log(this.seasons);
this.updateSeasons.next([...this.seasons]);
});
}
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: 7.5.1
- Device: Desktop
- Browser: Chrome/MS Edge
- OS: Win 10
- Provided sample code: No
- Provided link: No