Simplified I have a component that can be used multiple times within any template. How would I get my component click-me to pair with the input element below it so when the event (click in this case) is fired it will apply (change the input type to hidden in this case) to that input. Obviously the approach is important here not the hide!
What can I add to pair them keeping the duplicate component generic and autonomous?
import {Component} from 'angular2/core';
@Component({
selector: 'click-me',
template: `<button (click)="onClickMe()">Hide A Friend Input</button>`
})
COMPONENT
export class DuplicateComponent {
onClickMe() {
alert("try change type");
this.type = "hidden";
}
}
TEMPLATE
<div>
<click-me></click-me>
<input type="input" value="friend 2 to hide" id="clickme1">
</div>
<div>
<click-me></click-me>
<input type="input" value="friend 2 to hide" id="clickme2">
</div>
