1👍
✅
Variable names can’t have a period .
in them, see JavaScript variable naming conventions: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#Variables
All you have to do is change the name of the argument variable in your function. It does not have to match the name from your HTML view:
setSelectedItem(passedInArgument) {
this.selected = passedInArgument;
}
passedInArgument
will be evaluated to whatever item.message
was in your view.
1👍
You pass an argument to a function in the form of ‘item.message’ but in the same function read passed argument ex like this:
setSelectedItem(item){
this.selected = item;
}
Source:stackexchange.com