{{title}}
nested: {{customer.name}}
function call: {{20 + add(2, 5)}}
{{customer.name}}
customer = {
id: "abc",
name: "Hans Muster",
};
add(a: number, b: number) {
return a + b;
}
- List Item 1
address = {
street: 'Example Street',
zipCode: '3000',
city: 'Bern'
}
renderAddress() {
return `${this.address.street},
${this.address.zipCode} ${this.address.city}`
}
- {{address.street}}
...
{{renderAddress()}}
Direction | Syntax | Name |
---|---|---|
One-way, Component to View |
|
Property, Attribute, Style... |
Direction | Syntax | Name |
---|---|---|
One-way, View to Component |
|
Event |
Two-way |
|
Two-way |
Click me
... or use the canonical form with the bind-prefix
I prefer the first (shorter) option and i will exclusively use this one.
<people (deletePerson)="delete($event)">
click me! logHello() { console.log("Hello"); }
... or the canonical option with the on-prefix
print(value) {
console.log(value);
}
... or read the value in the method
printEvent(event) {
console.log(event.target.value);
}
printSValues(val: number | string | null) { if(typeof val === "string" && val.toLowerCase().startsWith("s")) { console.log(val); } }
{{name}}
name = "Hans";
Or with a function in the component:
{{name}}
name: String | undefined = "Hans";
<input #note>
print(value) {console.log(value);}
Button