Skip to content

Instantly share code, notes, and snippets.

@ketan-benegal
Created March 15, 2019 03:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ketan-benegal/5ac6b4568bc5355cd922dc9041352cac to your computer and use it in GitHub Desktop.
Save ketan-benegal/5ac6b4568bc5355cd922dc9041352cac to your computer and use it in GitHub Desktop.
import { LightningElement, track } from 'lwc';
export default class HelloWorld extends LightningElement {
// @track greeting = 'World';
@track firstName = '';
@track lastName = '';
@track showLastNameOnly = false;
changeHandler(event) {
// this.greeting = event.target.value;
const fldValue = event.target.name;
if(fldValue === 'first_name')
this.firstName = event.target.value;
else if(fldValue === 'last_name')
this.lastName = event.target.value;
}
handleCheckBox(event){
this.showLastNameOnly = event.target.checked;
}
get showLastNameOnly(){
return this.showLastNameOnly;
}
get upperCaseName(){
if(this.showLastNameOnly){
return `${this.lastName}`.toUpperCase();
}
else{
return `${this.firstName} ${this.lastName}`.toUpperCase();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment