Created
March 15, 2019 03:04
-
-
Save ketan-benegal/5ac6b4568bc5355cd922dc9041352cac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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