search

Home  >  Q&A  >  body text

angular.js - When the submit button in angular is clicked, how can the hide prompt text be shown? ? ng-show='What is written here'

The submit button in angular is clicked. Then, hide the prompt text and show? ?

阿神阿神2866 days ago613

reply all(2)I'll reply

  • 仅有的幸福

    仅有的幸福2017-05-15 17:04:27

    What the questioner wants to ask is how to replace the text in the button? Bind a click event to the button to change a variable that identifies the state, and then determine what content is displayed through the variable.

    reply
    0
  • PHPz

    PHPz2017-05-15 17:04:27

    Define a variable to control and change the value of your variable in the submit event, for example
    html

    <button ng-click="submitFunc()" ng-show="btnShow" style="display:none;">提交前</button>
    <button  ng-hide="btnShow" style="display:none;">提交后</button>
    <p ng-hide="btnShow" style="display:none;">提交后显示的文字</p>

    js

    $scope.btnShow=true;
    $scope.submitFunc=function(){
      $scope.btnShow=fasle;
      //以下是你点击提交的其他代码
    }

    reply
    0
  • Cancelreply