viewChild/viewChildren 是与<template>和component试图获取相关,获取view。
contentChild/contentChildren 是关于<ng-content>内容获取相关,其中<ng-content>的select属性支持选择器区分映射进来的内容。
其中的viewChildren和contentChildren返回的是一个QueryList,是一个可订阅的列表
viewChild/viewChildren 是与<template>和component试图获取相关,获取view。
contentChild/contentChildren 是关于<ng-content>内容获取相关,其中<ng-content>的select属性支持选择器区分映射进来的内容。
其中的viewChildren和contentChildren返回的是一个QueryList,是一个可订阅的列表
本文标题:Angular--viewChild和contentChild
本文链接:https://www.haomeiwen.com/subject/qoptiktx.html
网友评论