简体   繁体   中英

hiding the button with ng-hide and ng-show

In this todo app, which is in angularjs, I need a help in hiding the button using ng-show and ng-hide derivative. when the text box is empty.

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

做就是了:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM