blob: 13cfdab239dfcd4cb01084864dba8229c1178a4e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
import { Component, OnInit } from '@angular/core';
import Predictor from 'src/app/_data/Predictor';
import { PredictorsService } from 'src/app/_services/predictors.service';
@Component({
selector: 'app-my-predictors',
templateUrl: './my-predictors.component.html',
styleUrls: ['./my-predictors.component.css']
})
export class MyPredictorsComponent implements OnInit {
predictors: Predictor[] = [];
constructor(private predictorsS : PredictorsService) {
}
ngOnInit(): void {
this.getAllMyPredictors();
}
delete(predictor: Predictor){
if(window.confirm("IZABRANI MODEL ĆE BITI IZBRISAN"))
{
this.predictorsS.deletePredictor(predictor).subscribe((response) => {
console.log("OBRISANOOO JEE", response);
//na kraju uspesnog
this.getAllMyPredictors();
}, (error) =>{
if (error.error == "Predictor with name = {name} deleted") {
alert("Greška pri brisanju modela!");
}
});
}
}
getAllMyPredictors(): void{
this.predictorsS.getMyPredictors().subscribe(m => {
this.predictors = m;
console.log(this.predictors);
});
}
}
|