Search code examples
javascriptember.jsember-data

Ember global variable for input size


I have a huge ember application and I'm trying to create a global variable/constant that I can use to set the default sizes of input fields. To be clear this is size as in the number of characters that can be entered, not size as in the CSS pixel size. How can I register a global variable such that instead of doing

{{input placeholder="Name..." maxlength=150}}

I can just do

{{input placeholder="Name..." maxlength=DefaultLength}}


Solution

  • You can reopen Ember.TextField and update maxlength property so that this value will be applicable all input helper.

    Ember.TextField.reopen({
      maxlength:250
    });