https://stackblitz.com/edit/angular-yasyzp-rpwq9o
split the attributes for every Component
Because Tooltip and Dropdown work with the same attributes I have problem to make tooltip on hover and dropdown by click.
| Environment | Info |
|---|---|
| ng-zorro-antd | 8.1.0 |
| Browser | FF |
Possible solution
@Component({
selector: 'nz-demo-dropdown-basic',
template: `
<a nz-dropdown #dropdown="nzDropdown" [nzDropdownMenu]="menu" nz-tooltip nzTitle="prompt text">
Hover me
<i nz-icon nzType="down"></i>
</a>
<nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu nzSelectable>
<li nz-menu-item>1st menu item</li>
<li nz-menu-item>2nd menu item</li>
<li nz-menu-item>3rd menu item</li>
</ul>
</nz-dropdown-menu>
`
})
export class NzDemoDropdownBasicComponent implements OnInit {
@ViewChild('dropdown', { static: true })
dropDown: NzDropDownDirective;
ngOnInit(): void {
this.dropDown.nzTrigger = 'click';
}
}
Notice the #dropdown="nzDropdown", as the NzDropDownDirective uses exportAs.
Looks similar to #3456
duplicate #3456
Most helpful comment
Possible solution
Notice the
#dropdown="nzDropdown", as theNzDropDownDirectiveusesexportAs.