Home > front end >  Require handling component EventEmitter @output
Require handling component EventEmitter @output

Time:07-25

selector: 'element[title]'

requires <element title="value" ></element> for the component to be display You will get an error if you don't use the require property like <element title="value" ></element>

How can I do this for EventEmitter output?

@Output() customEvent = new EventEmitter<boolean>()
this.customEvent.next()

<element title="value" (customEvent)="handleCustomEvent()"></element>

Doesn't work selector: 'element[title](customEvent)'

Ultimately, I just want my code to tell me something is wrong before I run my code.

CodePudding user response:

You need to emit @Output variable like below in element component

this.customEvent.emit(true);

If this is not you are looking for, feel free to modify below Stackblitz example

Stackblitz: https://angular-ivy-wjru8q.stackblitz.io

CodePudding user response:

This is what I was looking for, Thank you Backhole.

It's ultimately just another property, so element[title][customEvent] should work. – Blackhole

  • Related