I'm currently following a YouTube tutorial and I've hit a roadblock trying to figure out where the error is originating from?
Error Message: Type 'Observable' is missing properties such as length, pop, push, concat, and 25 more.ts(2740)
export class ToDosComponent implements OnInit {
todos:Todo[];
constructor(private todoService:TodoService) { }
ngOnInit(): void {
this.todos = this.todoService.getTodos();
}
This refers to the specific class:
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Todo } from '../models/Todo';
@Injectable({
providedIn: 'root'
})
export class TodoService {
todosUrl = 'https://jsonplaceholder.typicode.com/todos';
todosLimit = '?_limit=5';
constructor(private http:HttpClient) { }
getTodos():Observable<Todo[]>{
return this.http.get<Todo[]>('${this.todosUrl} $ {this.todosLimit}');
}