How do I lowercase a field using Handlebars.js?

前端 未结 5 1080
我寻月下人不归
我寻月下人不归 2021-02-01 14:27

I want to do something like this:

{{user.name.toLowerCase()}}

but I get this error:

Error: Parse error on line X:
...tatus {{us         


        
5条回答
  •  一生所求
    2021-02-01 14:36

    As simply explained in the doc :

    Handlebars.registerHelper('toLowerCase', function(str) {
      return str.toLowerCase();
    });
    

    And just use it like this :

    By {{toLowerCase author}}

提交回复
热议问题