Hello. I am trying to sample data (for example, to get records in which the number is equal to something. Without filter, everything works)
http.get(baseUrl + 'api/Student/Students1') .filter( stud => stud.Phone == 123) .subscribe(data => { this.studentTEST = data.json() as Students[]; }, error => console.error(error)); Mistake:
"Property 'Phone' does not exist on type 'Response'".
The angular version was 4.2.5, then changed in package.json to 5.1.0 and, like npm, updated to version 5.
How else can you filter the data?
It seems to understand. (For example, sample data (weather) from the template vs angular works). But my data from the database does not filter
Controller:
[HttpGet] public IEnumerable<Students> GetStudent() { return db.Students; } Interface Students:
interface Students { Address: string; Email: string; Phone: string; StdName: string; } Request:
http.get(baseUrl + 'api/Student/Students1') .subscribe(result => { this.std = (result as Students[]).filter(s => s.Email === "ffff"); }, error => console.error(error)); If you do filter(std => std.Email != "ffff") , for example, it displays everything, but if you try to filter something, it doesn't output anything