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

132
Views
How to filter JSON inside an angular ionic component?

I'm trying to map and filter a JSON inside a component but I have not succeeded, from the service "data.services.ts" I had no problem, but when taking the data to the component "tab1.page.ts" I couldn't, the usual thing I do is use:

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

Tab1.page.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
      })
  }

}

data.services.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
            })
        );
    }
}

I'm trying:

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"
        })
        });       
      }
  }

But I have not been lucky.

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!