I'm struggling to log the name value on a click event. Can you please provide some guidance? This is inside the .ts file:
export class ScrolldemoComponent implements OnInit {
constructor() { }
ngOnInit() {
const name = "test";
}
myEvent(event) {
console.log(name);
}
}
This is inside the HTML:
<button (click)="myEvent()">My Button</button>