title: why <app-root> is not a known element with out body tag
body: <p>I am new to this angular 6. This may be stupid to ask but i want to make my concept clear. Below is the code my of appComponent typescript</p>
  
  <pre><code>   import { Component, OnInit, Inject } from '@angular/core';
  import {ToastrService} from './services/toastr.service';
  
  
  @Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: [],
    providers:[ToastrService]
  })
  export class AppComponent  {
    }
  </code></pre>
  
  <p>when i put <code>&lt;app-root&gt;</code> in the index.html in the following format. it works perfectly fine.</p>
  
  <pre><code> &lt;html&gt;
  
      &lt;body&gt;
              &lt;app-root&gt;&lt;/app-root&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>but when i remove the html and body tags it just give me an error given below.</p>
  
  <pre><code>main.ts:12 Error: The selector "app-root" did not match any elements
      at DefaultDomRenderer2.push../node_modules/@angular/platform-browser/fesm5/platform-browser.js.DefaultDomRenderer2.selectRootElement (platform-browser.js:1073)
      at BaseAnimationRenderer.push../node_modules/@angular/platform-browser/fesm5/animations.js.BaseAnimationRenderer.selectRootElement (animations.js:229)
      at DebugRenderer2.push../node_modules/@angular/core/fesm5/core.js.DebugRenderer2.selectRootElement (core.js:20837)
      at createElement (core.js:17499)
      at createViewNodes (core.js:19737)
      at createRootView (core.js:19690)
      at callWithDebugContext (core.js:20722)
      at Object.debugCreateRootView [as createRootView] (core.js:20208)
      at ComponentFactory_.push../node_modules/@angular/core/fesm5/core.js.ComponentFactory_.create (core.js:18029)
      at ComponentFactoryBoundToModule.push../node_modules/@angular/core/fesm5/core.js.ComponentFactoryBoundToModule.create 
  </code></pre>
  
  <p>So my question is.. Do i have to write <code>&lt;app-root&gt;</code> alway in html or body tag? or is there any other way to write  <code>&lt;app-root&gt;</code>  with out writing in html or body tag? </p>
  
  <p>Thanks</p>