1
I would like to define the tag <body>
as root of my Angular 2 application instead of creating a daughter tag <my-app>
(for example).
1
I would like to define the tag <body>
as root of my Angular 2 application instead of creating a daughter tag <my-app>
(for example).
0
Define body
as the root component selector of your application.
Something like
import { Component } from '@angular/core';
@Component({
selector: 'body',
template: '<h1>{{mensagem}}</h1>'
})
export class AppComponent {
String mensagem = "Minha primeira aplicação Angular 2";
}
Browser other questions tagged html5 angular angularjs-directives
You are not signed in. Login or sign up in order to post.
My doubt is just this. In the previous version, Angularjs, this was very intuitive because we used a directive as an attribute of the ex tag:
<body ng-app="my-app">...</ body>
. Already in Angular 2, so I have seen so far the application or component is the tag itself as I have shown before:<my-app>...</ my-app>
– Edgar Damasceno
Unless you want to win award for minimalism, could you explain better the solution you are giving? Thank you! :)
– Daniel
@Edgardamasceno edited the answer
– mercador
Very good, @merchant ! It was exactly what I was looking for but there was no attempt to define the component.
– Edgar Damasceno