E
E
Egor Mordvinov2016-08-10 15:58:37
JavaScript
Egor Mordvinov, 2016-08-10 15:58:37

What is the problem with clearing the field?

There is an input with

(value='{{ profile.defaultPassInputs.inputValue }}')

And a cancel button with (ng-click='profile.setEmptyInputs("inputCancel")')
the following added in the controller
this.defaultPassInputs = {
            inputValue: '',
        }

setEmptyInputs(action) {    
      if (action === "inputCancel") {
          this.defaultPassInputs.inputValue = '';
          this.core.popupWindow(this.core.hasPopups(),'hide'); //закрывает модальное окно, в котором все происходит
         }
      }

My guess this.defaultPassInputs.inputValue = '';would be to pass just an empty value to the value of the input before closing, and when the modal is reopened, the input won't contain the previous value, but that doesn't happen. What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Daniil Sorokin, 2016-08-10
@DanSorokin

I guess you should use ng-model instead of value.

L
lega, 2016-08-10
@lega

When calling a f-ii, an incorrect this may be specified, you need to check, try this:

var _that = this;
setEmptyInputs(action) {
  _that.defaultPassInputs.inputValue = '';

although it depends on the application, the whole code is not visible

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question