angular - Facing Error: angular4 error:val.slice is not a function? -
i running error:
click refresh() or delectrole(i) button error:
error typeerror: val.slice not function @ datatable.set [as value] (datatable.js:508)
what's wrong? data can transmitted, needs flushed display
which value not function? remove 'i',but doesn't work:
import { component, oninit, viewchild } '@angular/core'; import { role } '../domain/role'; import { roleservice } '../service/role.service'; import { requestoptions , headers} '@angular/http'; @component({ templateurl: 'rolelist.html', providers: [confirmationservice] }) export class rolelist implements oninit { public loading = false; roles: any; // 开启switch active: boolean = true; delectselectedidjson: string; msgs: message[] = []; constructor(private roleservice: roleservice, private confirmationservice: confirmationservice, ) { } ngoninit() { this.loading = true; this.roleservice.getrolelist({}).then(roles => { this.loading = false; this.roles = roles.all; }); } // refresh refresh() { this.loading = true; this.roleservice.getrolelist({}).then(roles => {this.roles = roles; this.loading = false; }); } // delectrole delectrole(i) { this.loading = true; this.delectselectedidjson = json.stringify({'roleid': i}); this.roleservice.getroledelect(this.delectselectedidjson).then(roles => { this.roles = roles; if (roles.code === '0000') { this.loading = false; this.refresh(); } else if (roles.code === '4000') { this.loading = false; return false; } }); } } <a class="btn btn-default" (click)="delectrole(role[col.field])" *ngif="roledelete()"><i class="fa fa-trash"></i></a> <a class="btn btn-default" (click)="refresh()"><i class="fa fa-refresh"></i>refresh</a>
Comments
Post a Comment