typescript - Angular 2, using body as root selector, instead of my-app -


are there downsides of using <body> tag instead of <my-app> tag root component?

import 'package:angular2/angular2.dart'; @component(     selector: 'body',     template: '''       <h1>my first angular 2 app</h1>        <div>{{greet}}</div>     ''',     styles: const ['''       :host {         height: 100vh;       }       h1 {         color: red;       }     ''']) class appcomponent {   string greet = 'hello world'; } 

(the code here dart, hope close enough es6, typescript other people understand.)

i don't see often, guess there reason it, seems nice me, otherwise have 2 root components, body, , my-app.

if want angular control whole page use body selector. see how change body class via typescript class (angular2)


Comments