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

597
Visualizações
Property interval does not exist in the type observable
ngAfterViewInit(){
     Observable.interval(3000).timeInterval().subscribe()=>{};    
}

Trying to invoke the Observable.interval() method it is throwing a compiler error "Property interval does not exist in the type observable".

Edit

import { Observable } from 'rxjs/Observable';

Note that the import statement is already included

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

For RxJS 6+ the answer given by Tomasz Kula only applies when using the rxjs-compat package, which should only be used when in the process of converting an application from RxJS 5 to RxJS 6.

Within RxJS 6+, use:

import { interval } from 'rxjs';

interval(3000).subscribe(x => /* do something */)

Note that any Observable creation function that previously existed on the Observable type, should now be imported from 'rxjs'.

over 4 years ago · Santiago Trujillo Relatório

0

this is correct for angular 6.1.+ and rxjs 6.2.+

import { Observable } from 'rxjs';
import { interval } from 'rxjs';

 interval(1000).subscribe(
         (value: number) => {
           this.secondes = value;
         },
         (error: any) => {
           console.log('error');
         },
         () => {
           console.log('observable completed !');
         }
       );

over 4 years ago · Santiago Trujillo Relatório

0

for rxjs 5.5.2+ it is:

import { interval } from 'rxjs/observable/interval';

usage:

interval(3000).subscribe(x => // do something)
over 4 years ago · Santiago Trujillo Relatório
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