New: Enveu Flow is now generally available — automate media operations alongside Experience Cloud. Learn more

Importance of ELVIS Operator in Angular Template HTML

 ELVIS Operator in Angular Template HTML

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

Chandan Luthra - Director, Product Engineering, Enveu
Chandan Luthra is a co-founder of Enveu, and heads the Engineering department at Enveu. He is an early adopter of OTT tech and has been part of many OTT platforms across the globe. He is developing & building Products and SaaS platforms for more than 13+ years

Add a Comment

Your email address will not be published. Required fields are marked *

Explore the Enveu platform

Ready to launch your streaming platform?

Talk to our team about building your OTT experience with Enveu Experience Cloud and Enveu Flow.

Book a demo

More from Enveu