Проблема в том, что интерполяция строк не работает, но когда я использую json pipe, он показывает данные объекта.Это действительно расстраивает, и в других компонентах интерполяция работает хорошо, поэтому я не могу понять, в чем проблема моего кода.
Вот код компонента:
import { Component, OnInit } from '@angular/core';
import { Category } from 'category';
import { CategoryService } from 'src/app/category.service';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'app-cat-detail',
templateUrl: './cat-detail.component.html',
styleUrls: ['./cat-detail.component.css']
})
export class CatDetailComponent implements OnInit {
category: Category;
constructor(private _categoryService: CategoryService,
private _route: ActivatedRoute) { }
ngOnInit() {
this.getCategory();
}
getCategory() {
const id = +this._route.snapshot.paramMap.get('id');
this._categoryService.getCategoryById(id)
.subscribe(data => this.category = data);
}
}
это шаблон:
<h1>Details</h1>
<ul>
<li>_id: {{category._id}} </li>
<li>category: {{category.category}}</li>
</ul>
Я буду благодарен за любую помощь!спасибо.