Я пытаюсь создать приложение, в котором я хочу получать свои сообщения сначала по пользователю, а затем при нажатии на сообщение я хочу получить это конкретное сообщение по идентификатору.
И наконец я получаю следующие ошибки:
ОШИБКА в src / app / cars / car-detail / car-detail.component.ts (25,11): ошибка
TS2322: Тип 'Наблюдаемый <{_id: string; название: строка; содержание:
строка; imagePath: строка; создатель: строка; }> 'нельзя назначить
введите 'Car []'.
Свойство «include» отсутствует в типе «Observable <{_id: string; название: строка; содержание: строка; imagePath: строка; создатель: строка; }>».
src / app / cars / car-detail / car-detail.component.ts (26,11): ошибка TS2322: тип 'номер' нельзя назначить типу 'строка'.
import { Input, Component, OnInit } from '@angular/core';
import { Car } from '../car.model';
import { CarsService } from '../cars.service';
import { ActivatedRoute, Params } from '@angular/router';
@Component({
selector: 'app-post-detail',
templateUrl: './post-detail.component.html',
styleUrls: ['./post-detail.component.css']
})
export class PostDetailComponent implements OnInit {
@Input() post: Post[] = [];
@Input() id: string;
constructor(
private postsService: PostsService,
private route: ActivatedRoute
) { }
ngOnInit() {
this.route.params
.subscribe(
(params: Params) => {
this.post = this.postsService.getPost(this.id);
this.id = +params['id'];
}
);
}
}
Что мне делать?