Just out of curiosity, I would like to know if there is any way to make a self closing component in Angular 2, just like the <input>
tag. So that I can use it in my template like:
<div> <my-input> </div>`
This template uses typical HTML elements like <h2> and <p> . It also includes Angular template-syntax elements, *ngFor , {{hero.name}} , (click) , [hero] , and <app-hero-detail> . The template-syntax elements tell Angular how to render the HTML to the screen, using program logic and data.
In order to use it in another Angular app, we don't really need to build the component; as it is a simple Angular component, we can just import and use it. But if we only have access to compiled files, we can include them with the scripts field in our angular.
For now, you can't create self-closing component.
https://github.com/angular/angular/issues/5563#issuecomment-161826319
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With