Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

214
Visualizações
How to subscribe the observable?

Github link

This is the file for the server connection, but there is an issue with it. The Subscribe part has been deprecated. Kindly sort it out!

import { Component } from '@angular/core';
import { map } from 'rxjs/operators';
import { Breakpoints, BreakpointObserver } from '@angular/cdk/layout';
import { Observable } from 'rxjs';
import { AppService } from '../app.service';

@Component({
  selector: 'app-dash',
  templateUrl: './dash.component.html',
  styleUrls: ['./dash.component.css']
})
export class DashComponent {
  /** Based on the screen size, switch from standard to one column per row */
  cards=[];
  cardsForHandset = [];
  cardsForWeb =[];
  isHandset:boolean=false;
  isHandsetObserver:Observable<boolean> = this.breakpointObserver.observe(Breakpoints.Handset).pipe(
    map(({ matches }) => {
      if (matches) {
        return true;
      }
      return false;


    })
  );

  constructor(private breakpointObserver: BreakpointObserver,
    public appService:AppService) {}
  ngOnInit(){
    this.isHandsetObserver.subscribe(currentObservervalue=> {
      this.isHandset = currentObservervalue;
      this.loadCards();

    });
    this.appService.getDeals().subscribe(  //here the subscribe is decrepted
      response =>{
        this.cardsForHandset = response.Handsetcards;
        this.cardsForWeb = response.Webcards;
        this.loadCards();

      },
      Error=>{
        alert('their is a problem in the server.please try again later')

      }
    )
  }
  loadCards(){
    this.cards =this.isHandset ? this.cardsForHandset:this.cardsForWeb;
  }
  getImage(imageName:string):string{
    return 'url('+'http://localhost:3000/images'+imageName+'jpg'+')';
  }
}

The declaration was marked as deprecated here:
Observable.d.ts(52, 9)
This is the error in my code.

about 4 years ago · Santiago Gelvez
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda