ViewChildren

ViewChildren decorator

What it does

Configures a view query.

How to use

.

import {AfterViewInit, Component, Directive, QueryList, ViewChildren} from '@angular/core';

@Directive({selector: 'child-directive'})
class ChildDirective {
}

@Component({selector: 'someCmp', templateUrl: 'someCmp.html'})
class SomeCmp implements AfterViewInit {
  @ViewChildren(ChildDirective) viewChildren: QueryList<ChildDirective>;

  ngAfterViewInit() {
    // viewChildren is set
  }
}

Description

You can use ViewChildren to get the 登录查看完整内容