I have an element that sends out a simple string when it is clicked
Here is the HTML code for my element:
<div (click)="emitSomething($event)"></div>
This is the TypeScript code for my element:
@Output() someString: EventEmitter<string> = new EventEmitter();
emitSomething(event: string) {
this.someString.emit(event)
}
Now, I would like to pass this string to another element so that I can utilize it there, how can I achieve that?
This is what I attempted in the second element:
<component-one (someString)="variable"></component-one>
The TypeScript code for my second element:
@Output() someString: EventEmitter<string> = new EventEmitter();
variable: string; // This variable should hold the string value from the first element
UPDATE: When I try this method, I receive the following error message in the console
Can't bind to 'someString' since it isn't a known property of 'component-one'.