0

In my project I am using angular js. I have a form and I am filling the form details using rest api. The form will get filled by object. I want to disable textbox which value was empty, so I used the following code.

<input id="Level2" ng-disabled="!EditMenu.Level2" ng-model="EditMenu.Level2" type="text" class="form-control" />

Its working fine. Its disabled when values are empty, but here my problem when users try to edit the values, they clear all the value to enter new value but user cannot be update any field since its got disabled when user clear all the value from the text box. Please help me on this.

4
  • How does the user clear all the values to be able to enter new ones? Is there a button for clearing? Or how do you set your "EditMenu.Level2" property? Commented Jul 2, 2018 at 5:56
  • this is just simple textbox so they use backspace button to clear all values Commented Jul 3, 2018 at 8:33
  • I am setting inititally EditMenu={} and fill values from rest api EditMenu = results; here results is a object from rest api. Commented Jul 3, 2018 at 8:33
  • reset by backspace button? I'm not really sure whether this is correct design. The form context might change and so the control might be reenabled. But the properties you set on the control used for the next request are staying or not - depends on cache or browser settings. It would be more of a proper design if you handle your reset within the current form view by adding a control changing the ng-disabled preferences. Commented Jul 3, 2018 at 9:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.