here is you not import Observable, observable that's why the problem occurred
import { Injectable } from '@angular/core';
import { Subject, Observable, observable } from 'rxjs';
@Injectable()
export class NewService {
messages$: Observable;
private pushSource = new Subject();
Country_Name;
constructor(private http:HttpClient,) {
this.messages$ = this.pushSource.asObservable()
}
categoryNews(category)
{
var categoryData = this.http.get(https://newsapi.org/v2/top-headlines?country=in&category=${category}&apiKey=*****
)
categoryData.subscribe(Data=> this.pushSource.next(Data));
}
news(t_h)
{
console.log(t_h);
this.pushSource.next(t_h);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…