<slot> functionality in angular 5
That's called transclusion, and is implemented with ng-content
through Angular.
See some tutorials online, such as https://scotch.io/tutorials/angular-2-transclusion-using-ng-content
This allows you to create components like this :
@Component({ selector: 'app-component', template: `<div class="container"><ng-content></ng-content></div>`})export class AppComponent {}
In your HTML :
<app-component>Some text</app-component>
Will be rendered as :
<div class="container">Some text</div>
Even you can have named ng-content
too. if you have multiple contents to be replaced. for example -
<ng-content select="[card-body]"></ng-content>