Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to make a self closing component in Angular 2?

Tags:

angular

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>`
like image 563
HirenParekh Avatar asked Dec 16 '16 06:12

HirenParekh


People also ask

What are the elements that we can use in angular templates?

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.

How can I use angular element in another angular project?

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.


1 Answers

For now, you can't create self-closing component.

https://github.com/angular/angular/issues/5563#issuecomment-161826319

like image 61
Jarek Avatar answered Oct 05 '22 07:10

Jarek