Angular 如何从parentComponent显示childComponent中的工具提示内容

Angular 如何从parentComponent显示childComponent中的工具提示内容,angular,bootstrap-4,tooltip,Angular,Bootstrap 4,Tooltip,我创建了一个组件,它是父组件:- @Component({ selector: 'parent', templateUrl: '../views/parent.view.html' }) export class ParentComponent { @ViewChild('primaryColorSample') primaryColorSample: AssetNoteComponent; } 父html:- <div> <a [toolti

我创建了一个组件,它是父组件:-

@Component({
    selector: 'parent',
    templateUrl: '../views/parent.view.html'
})
export class ParentComponent {
    @ViewChild('primaryColorSample')
    primaryColorSample: AssetNoteComponent;
}
父html:-

<div> <a [tooltip]="primaryColorSample">add</a>
    <child #primaryColorSample></child>
</div>
 
子HTML:-

<tooltip-content #primaryColorSample [animation]="true" placement="left">
  <input type="text" name="child" required="true" />
  <button>save</button>
</tooltip-content>

拯救
我无法使用来自父html的工具提示内容,请您建议我如何执行此操作。
我正在使用ngx tooltop和Angular。

在子组件中声明输入

<child #primaryColorSample [tooltip]="primaryColorSample"></child>

从ngx tooltip的文档和源代码中,我们可以看到
[tooltip]
输入类型为string或ToolTiContent组件

您可以将子模板(ToolTicContent)移动到父模板的顶部,然后删除
。这会奏效的


在设置中,使用
ViewChild
获取对
Child
组件的引用,得到的是对子组件类的引用,而不是字符串,也不是ToolTiContent组件,所以它不起作用。

它不起作用。。我正在从父级传递add div add中的输入。我需要悬停子内容。谢谢@Rex。。是的,它起作用了,所以不能在子组件中使用工具提示吗?或者是否有其他方法来执行此操作,因为我需要在childComponent内部使用输入和保存,并且必须使用输出将数据发送到父组件。可能有一种方法:将
保留在父组件中,但在其内部,用输入和添加按钮插入子组件。非常感谢:)@Rex…为什么我没有想到这个主意。@Sakura不客气。下次您将在其他场景中了解此想法。:-)
<child #primaryColorSample [tooltip]="primaryColorSample"></child>