Я разрабатываю CRUD в своем приложении с Angular 5, метод GEt и POST работает, но метод DELETE не работает (удаляет динамические данные), у меня есть эта ошибка:
DELETE http://172.16.47.34:8282/MyProject.webservices/api/Roles?UID={UID} 500 (Internal Server Error)
как исправленоэта ошибка и благодарность
это мой код .html:
....
(click)="onDelete()"
...
и это мой код .ts:
export interface Role {
RoleName: string;
}
@Component({
selector: 'app-role',
templateUrl: './role.component.html',
styleUrls: ['./role.component.css']
})
export class RoleComponent implements OnInit, AfterViewInit {
private roles: any;
constructor(private _roleService: RoleService, private http: HttpClient) { }
onSubmit(role: Role) {
return this.http.post('http://172.16.47.34:8282/MyProject.webservices/api/Roles', role).subscribe(status => console.log(JSON.stringify(status)));
}
onDelete(role: Role) {
return this.http.delete('http://172.16.47.34:8282/MyProject.webservices/api/Roles?UID={UID}', role).subscribe(status => console.log(JSON.stringify(status)));
}
onUpdate(role: Role) {
return this.http.put('http://172.16.47.34:8282/MyProject.webservices/api/Roles', role).subscribe(status => console.log(JSON.stringify(status)));
}