Conditional duplicate templateref in ng-content with selector
问题 I have a component which toggles the component's template based on client device size. Component code is: import {Component} from '@angular/core'; import {BreakpointObserver, Breakpoints} from '@angular/cdk/layout'; @Component({ selector: 'ui-switcher', template: ` <ng-content *ngIf="isSmall" select="mobile"></ng-content> <ng-content *ngIf="!isSmall" select="web"></ng-content> ` }) export class UiSwitcherComponent { public isSmall: boolean; constructor(breakpointObserver: BreakpointObserver)