【问题标题】:hiding the button with ng-hide and ng-show用 ng-hide 和 ng-show 隐藏按钮
【发布时间】:2019-03-03 23:35:17
【问题描述】:

在这个 angularjs 中的 todo 应用程序中,我需要帮助来使用 ng-show 和 ng-hide 衍生工具来隐藏按钮。当文本框为空时。

$scope.addTodo = function () {
    if ($scope.formTodoText.length > 0) 
    {
    $scope.todos.push({text:$scope.formTodoText, done:false});
     $scope.formTodoText = '';
    } 
    else {
    alert('TODO text is empty');
   }     
};

【问题讨论】:

  • 你应该添加标记。

标签: javascript html angularjs


【解决方案1】:

只要做:

ng-hide="formTodoText.length == 0"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-12
    • 2014-12-08
    • 2014-03-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多