Instantiate transcluded components depending on their DOM state in angular 2
Common menu usage case <menu> <menu-item1></menu-item1> <menu-item2></menu-item2> <menu-item3></menu-item3> </menu> menu template <div *ngIf="open$ | async"> <ng-content></ng-content> </div> I was suprised to hear that all menu-item* components ( and all their children ) will be instantiated despite their presence in DOM and menu component *ngIf state. Their OnInit and AfterViewInit hooks will be called even if menu has never been opened and OnDestroy will never fires despite real adding-removing from DOM. Here is a closed issue about this https://github.com/angular/angular/issues/13921 (there