Action for input assistant

I have a text box that I want to have “dynamic” placeholder text (defined and managed in the view), but I also want it to have an action specific to it. I tried the following two lines:

{{ input id="test" placeholder=view.text action expand target="view"}} <input type="text" id="test" placeholder="{{view.text}}" {{action expand target="view"}} /> 

Both do not work. So my question is: is there a way to achieve what I want, or would it be easier to have a focus handler in the view that just filters for id (and then calls the extension function)?

+4
source share
2 answers

You can try to do it like this:

 <input type="text" id="test" {{bindAttr placeholder=view.text}} {{action expand target="view"}} /> 

See here for a working example.

Hope this helps

+2
source

If you want to use input helpers, you can do something like this:

 {{input placeholder=view.text action="expand" targetObject=view}} 

Note that targetObject must not be a string.

+12
source

Source: https://habr.com/ru/post/1490759/


All Articles