title: How to inject document.body in Angular 2
body: <p>I want to add some text in <strong>showlist.component.html</strong>. My code is given below, I am not aware how to use <code>document.body</code> in Angular 2.</p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  import { DOCUMENT } from '@angular/platform-browser';
  
  @Component({
    selector: 'app-showlist',
    templateUrl: './showlist.component.html',
    styleUrls: ['./showlist.component.css']
  })
  export class ShowlistComponent implements OnInit {
  
  public myname = "saurabh";
  
    constructor() { }
  
    ngOnInit() {
  //this.myname.appendTo(document.body);
  document.body(this.myname);
   //document.write(this.myname);
    }
  
  }
  </code></pre>