Are there any downsides of using the <body>
tag instead of some <my-app>
tag for the 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 is Dart, but I hope it is close enough to ES6, typescript for other people to understand.)
I don't see this often, so I guess there is a good reason for it, but this seems nice to me, otherwise you basically have two root components, body, and my-app.