Why do the uppercase/lowercase pipes exist in Angular?
Any situation I can think of that they would be used for you could just use the below CSS instead:
text-transform: uppercase|lowercase
Any examples for using this in pipe in production where the text-transform in css wouldn't work or be the best solution?
UpperCasePipelinkTransforms text to all upper case. {{ value_expression | uppercase }}
LowerCasePipe: UpperCasePipe is used to transforms text to lowercase.
TitleCasePipe is used to Transforms all the text to titlecase.
Angular lowercase pipe accepts only string types.
This is why:
console.log($("input").val());
input{
text-transform: lowercase;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" value="EXAMPLE" />
If you use a pipe to lowercase, then the value will be lowercase.
So if you aren't using an input field or don't intend on extracting the data from an element, then I would say just to use css - at least then you will only have to define this in 1 place (ideally), compared to having to explicitly use a pipe in all fields which is an extensibility nightmare for larger applications.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With