Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

137
Views
¿Cómo filtrar JSON dentro de un componente iónico angular?

Estoy intentando mapear y filtrar un JSON dentro de un componente pero no lo he logrado, desde el servicio "data.services.ts" no tuve problema, pero al llevar los datos al componente "tab1.page.ts" me no pude, lo habitual que hago es usar:

 .pipe( map((res: any) => { return res }) );

Tab1.página.ts

 import { Component, OnInit } from '@angular/core'; import { DataService } from '../services/data.services'; import { map } from "rxjs/operators"; import { filter } from "rxjs/operators"; @Component({ selector: 'app-tab1', templateUrl: 'tab1.page.html', styleUrls: ['tab1.page.scss'] }) export class Tab1Page implements OnInit { items = [] constructor(private dataService: DataService) {} ngOnInit(): void { this.dataService.getRemoteData().subscribe(data=> { this.items = data }) } }

servicios.de.datos.ts

 import { Injectable, Input } from "@angular/core"; import { HttpClient } from "@angular/common/http"; import { map } from "rxjs/operators"; import { filter } from "rxjs/operators"; @Injectable({ providedIn: "root" }) export class DataService { constructor(private http: HttpClient) {} getRemoteData() { return this.http .get("https://api") .pipe( map((res: any) => { return res.prosugApi }) ); } }

Lo estoy intentando:

 export class Tab1Page implements OnInit { items = [] constructor(private dataService: DataService) {} ngOnInit(): void { this.dataService.getRemoteData().subscribe(data=> { this.items = data return this.items.filter((filter1) => { return filter1.sublinea == "SOFA" }) }); } }

Pero no he tenido suerte.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!