Converting to lowercase via channel in Angular
Using the LowerCasePipe pipe, you can convert a string to lowercase. Let's try it in practice. Let's say we have the following string in the component class:
export class AppComponent {
name: string = 'JOHN';
}
Let's output our string in the template file, using our channel in it:
<div>
{{ name | lowercase }}
</div>
Result of code execution:
<div>
john
</div>
Let's say you have an array:
export class AppComponent {
products: string[] = ['Milk', 'Bananas', 'Fish', 'Bread'];
}
Print each element of the array in lowercase.