Reading an article with the post component

The post component just shows a single post with all the details. To display this single post, it receives the parameter from the URL and passes the parameter to the byId method in the blog service class:

import { Component, OnInit } from '@angular/core';import { ActivatedRoute, ParamMap } from '@angular/router';import { BlogService } from './../blog.service';@Component({  selector: 'app-post',  templateUrl: './post.component.html',  styleUrls: ['./post.component.css']})export class PostComponent implements OnInit {  public post;  constructor(    private route: ActivatedRoute,    private blogService: BlogService,  ) { }  ngOnInit() {    this.route.params.subscribe(params => { = this.blogService.byId( ...

Get TypeScript 2.x for Angular Developers now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.