How to convert a string into uppercase in AngularJS?

Sometimes we may need to represent a name or a string in capital letters. To convert a string into uppercase in AngularJS, we can use the uppercase filter to change its case to uppercase.

Syntax

  • In HTML Template Binding
{{uppercase_expression | uppercase}}
  • In JavaScript
$filter('uppercase')()

Example ? Conversion to Upper Case

Create a file "uppercase.html" in your Angular project directory and copy-paste the following code snippet.




   uppercase Filter
   




   

      Welcome to Tutorials Point    

   

      AngularJS | UpperCase Filter    

   
     

         

            Original: {{message}}          

         

            Modified: {{message | uppercase}}          

     

   

   

Output

To run the above code, just go to your file and run it as a normal HTML file. You will see the following output on the browser window.

Updated on: 2021-10-06T08:04:23+05:30

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements