ELVIS Operator can be used to check “undefined” on keys/fields/properties in html template file, Its means when you access keys in objects. And in object, some keys may be available or not. like Example.
results :
{
“name” : “Mohan”,
“emailId” : “mohan563@gmail.com”,
“gender” : “male”
}
Suppose, I want to access “emailId” key in template html file of an Angular project, for e.g “results.emailId“, here “results.emailId” key is always available in JSON object then its not compulsory use to ELVIS Operator. But in case the keys does not exists then ELVIS Operator comes to rescue us by applying a safe referencing to the JSON object e.g. “results?.emailId“. The “?.” operator allows to use the JSON keys that are not present. It will results in a “null” value.
—
Pravin kumar
pravin(d0t)kumar(at the rate)enveu(d0t)com