0

I am using angular-formly plugin to display my form. I have an input field. When user enters a character in the field, i will add only one more input box. So, onKeyUp listener must be triggered only once like $.once in jquery.

I am not sure, how to do this with Angular-formly. Plunker code here adds a new field for every character which is not desired.

  • 2
    a workaround mentioned at http://stackoverflow.com/questions/17449076/angularjs-event-handler-thats-executed-only-once – Bhabishya Kumar Apr 11 '16 at 16:25
  • `$touched` is triggered when you input's value has changed in the first place, more [in this thread](http://stackoverflow.com/questions/25025102/angular-difference-between-pristine-dirty-and-touched-untouched) – t3__rry Apr 11 '16 at 16:26
  • Can't you just add an if to check the length of $scope.fields? – tpsilva Apr 11 '16 at 16:28
  • thank you all. i was trying to repeat adding input fields when the user reaches/enters in the last input field. Bhabishya's answer helped me, and here is the new plunker, https://plnkr.co/edit/iiJ8Uuafl3yt1uxs76qN?p=preview –  Apr 11 '16 at 17:17

0 Answers0