ng-component-outlet

Angular 7: injection with dependencies for ngComponentOutlet

孤人 提交于 2019-12-13 03:02:26
问题 I need to use some kind of @Input() decorator for my ngComponentOutlet . But seems that Angular hasn't this feature. Instead, all things that I want to pass inside my outlet components should be provided via Injector . And it's fine if I want to initiate the thing I want provide to inside injectable class. But I need to dive deeper and provide some kind of observable variable ( Observeble<number> type for example) at creation Injector step. But I can't to get observable variable inside outlet

How to ngFor on multiple types of components using ngComponentOutlet?

╄→尐↘猪︶ㄣ 提交于 2019-11-29 02:13:10
I've got a whatsapp-like chat case of many types of messages that are needed to be displayed differently. Each has its' own component such as TextMessageComponent , FileMessageComponent , etc.. I'd like to be able to ngFor once on my array of messages without having to ngIf over the types. I've heard ngComponentOutlet might be the solution but found it hard to implement.. Any suggestions, a mini demo or anything you find useful would be highly appreciated! Having a property on the object should help you <div *ngFor="let item of items" style="border: solid 1px; padding: 20px;margin: 20px;">

How to ngFor on multiple types of components using ngComponentOutlet?

微笑、不失礼 提交于 2019-11-27 16:32:28
问题 I've got a whatsapp-like chat case of many types of messages that are needed to be displayed differently. Each has its' own component such as TextMessageComponent , FileMessageComponent , etc.. I'd like to be able to ngFor once on my array of messages without having to ngIf over the types. I've heard ngComponentOutlet might be the solution but found it hard to implement.. Any suggestions, a mini demo or anything you find useful would be highly appreciated! 回答1: Having a property on the object