Evan Sevy
Evan Sevy

Reputation: 687

What does ${...} syntax mean in Angular? The money symbol prepending curly braces?

I can't seem to find what the following syntax means in Angular (or perhaps it's just Javascript):

name() {
     return ${this.firstName} ${this.lastName};
}

specifically the ${...}?

Is it an Angular thing or is it just Javascript?

-thanks

Upvotes: 0

Views: 84

Answers (1)

Callam
Callam

Reputation: 11539

These are known as Template literals allowing you to essentially inject expressions into a multiline string without any messy concatenation, but you must enclose them inside back-ticks.

name() {
     return `${this.firstName} ${this.lastName}`;
     // as opposed to this.firstName + ' ' + this.lastName
}

Upvotes: 2

Related Questions