• +91 9723535972
  • info@interviewmaterial.com

Vue JS Interview Questions and Answers

Question - What are filters?

Answer -

Filters can be used to apply common text formatting. These Filters should be appended to the end of the JavaScript expression, denoted by the “pipe” symbol. You can use them in two specific cases:

mustache interpolations
v-bind expressions
For example, Let's define a local filter named capitalize in a component’s options

filters: {
  capitalize: function (value) {
    if (!value) return ''
    value = value.toString()
    return value.charAt(0).toUpperCase() + value.slice(1)
  }
}
Now you can use the filter in either mustache interpolation or v-bind expression,

{{ username | capitalize }}


Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners