| 1234567891011121314151617181920 |
- import { Component, OnInit, ViewChild, ElementRef, AfterViewInit, Output, EventEmitter, Input } from '@angular/core';
- import { Content } from '@angular/compiler/src/render3/r3_ast';
-
- @Component({
- selector: 'app-content',
- templateUrl: './hasContent.component.html',
- styleUrls: ['./hasContent.component.css']
- })
- export class HasContentComponent implements AfterViewInit {
- @ViewChild('content') content: ElementRef;
- @Input() hasChild: Boolean = false;
- @Output() hasChildChange : EventEmitter<Boolean> = new EventEmitter<Boolean>()
-
- constructor() { }
-
- ngAfterViewInit(){
- this.hasChildChange.emit(!!this.content.nativeElement.childNodes.length);
- }
-
- }
|