search

Home  >  Q&A  >  body text

angular.js - angular local dom refresh problem

dom

<input type="text" value="{{ val}}"/> <textarea ng-bind="msg"></textarea>

Operation

  1. Click to open the pop-up layer, enter the data -> Confirm -> scope to save the data, close the pop-up layer
  2. Click to open the pop-up layer, enter the data - "Cancel -" scope does not save the data, close the pop-up layer

Question

When performing the second operation, the scope did not save the entered text. When the popup layer was opened again, the entered text was still retained. I want to execute $scope.$apply() to refresh when I click to open, but it fails with an error. . So, how to refresh scope->view?

某草草某草草2792 days ago791

reply all(1)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-15 16:54:55

    I don’t understand what you mean, but if you want to reset the input box in the pop-up layer when it is closed or opened, wouldn’t it be enough to just clear the corresponding object or attribute in the scope?

    reply
    0
  • Cancelreply