import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { AngularFireDatabase } from '@angular/fire/database';
import {Observable} from 'rxjs';
@Component({
selector: 'app-my-pro-detals',
templateUrl: './my-pro-detals.component.html',
styleUrls: ['./my-pro-detals.component.css']
})
export class MyProDetalsComponent implements OnInit {
item;
itemValue = '';
items: Observable<any[]>;
ngOnInit() {
this.route.paramMap.subscribe(params => {
this.item = this.items[+params.get('productId')];
});
}
constructor(
private route: ActivatedRoute,
public db: AngularFireDatabase
) {this.items = db.list('items').valueChanges(); }
}
<div *ngIf="item">
<h3>{{ item.name }}</h3>
<p>{{ item.description }}</p>
</div>
Подскажите, что я делаю не так?