| import { Component<% if(!!viewEncapsulation) { %>, ViewEncapsulation<% }%><% if(changeDetection !== 'Default') { %>, ChangeDetectionStrategy<% }%> } from '@angular/core'; |
| import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; |
| import { Observable } from 'rxjs'; |
| import { map, share } from 'rxjs/operators'; |
| |
| @Component({ |
| selector: '<%= selector %>',<% if(inlineTemplate) { %> |
| template: ` |
| <%= indentTextContent(resolvedFiles.template, 4) %> |
| `,<% } else { %> |
| templateUrl: './<%= dasherize(name) %>.component.html',<% } if(inlineStyle) { %> |
| styles: [` |
| <%= indentTextContent(resolvedFiles.stylesheet, 4) %> |
| `]<% } else { %> |
| styleUrls: ['./<%= dasherize(name) %>.component.<%= style %>']<% } %><% if(!!viewEncapsulation) { %>, |
| encapsulation: ViewEncapsulation.<%= viewEncapsulation %><% } if (changeDetection !== 'Default') { %>, |
| changeDetection: ChangeDetectionStrategy.<%= changeDetection %><% } %> |
| }) |
| export class <%= classify(name) %>Component { |
| |
| isHandset$: Observable<boolean> = this.breakpointObserver.observe(Breakpoints.Handset) |
| .pipe( |
| map(result => result.matches), |
| share() |
| ); |
| |
| constructor(private breakpointObserver: BreakpointObserver) {} |
| |
| } |