import { Component, OnInit, ContentChild, TemplateRef, ViewContainerRef, ViewChild } from '@angular/core'; import { Propertiy } from 'src/app/interface/propertiy-interface'; import { FormGroup, FormControl } from '@angular/forms'; @Component({ selector: 'tooltip-demo', templateUrl: './tooltip-demo.component.html', styleUrls: ['./tooltip-demo.component.scss'] }) export class TooltipDemoComponent implements OnInit { properties: Array = [ { name: 'content', value: "'primary'|'warning'|'danger'|'success'|'link'|'secondary'", type: '@Input()', description: '设置按钮类型,可选值为怕primary/warning/danger等几个类型,默认值为primary' }, { name: 'disabled', value: 'boolean', type: '@Input()', description: '设置禁用,默认值为false' }, { name: 'size', value: '"small"|"large"', type: '@Input()', description: '设置尺寸,默认值为small' } ]; binding = 'aa'; binding1 = 'aa'; @ViewChild('tpTemplate') tpTemplate: TemplateRef; @ViewChild('tpTemplate2') tpTemplate2: TemplateRef; tmplVariable=null; defaultValue="测试啊" tipsValue="测试啊"; tpHtml="注意:要加大疫情防控"; tpHtmlLong="注意:要加大疫情防控

这样的说明文档特别长

"; formGroup = new FormGroup({ name: new FormControl("黄河之水天上来,奔流到海不复还"), address:new FormControl("山东省济南市"), enableTips:new FormControl(true), }); constructor(private viewContainer: ViewContainerRef) { } ngOnInit(): void { // const a = this.tpTemplate.createEmbeddedView(null); // this.viewContainer.insert(a); this.tmplVariable= this.tpTemplate; } changeTemplate(){ this.tmplVariable=this.tpTemplate2; } }