检测输入是否为 0 然后显示所有值
Detect if input is 0 then show all values
我有这个功能可以搜索数据库
app.limit = 5; // Set a default limit to ng-repeat
app.searchLimit = 0; // Set the default search page results limit to zero
app.search = function(searchKeyword, number) {
// Check if a search keyword was provided
if (searchKeyword) {
// Check if the search keyword actually exists
if (searchKeyword.length > 0) {
app.limit = 0; // Reset the limit number while processing
$scope.searchFilter = searchKeyword; // Set the search filter to the word provided by the user
app.limit = number; // Set the number displayed to the number entered by the user
} else {
$scope.searchFilter = undefined; // Remove any keywords from filter
app.limit = 0; // Reset search limit
}
} else {
$scope.searchFilter = undefined; // Reset search limit
app.limit = 0; // Set search limit to zero
}
};
以及使用搜索功能的输入。每次用户按下一个键,table 过滤器
<input type="text" class="form-control" name="search"
placeholder="search for..."
ng-model="searchKeyword"
ng-keyup="management.search(searchKeyword, number);">
问题是当我退格所有字符串并且没有输入时,tables 不显示任何数据,有什么方法可以检测输入是否为 = 0 以便我可以使用我的函数 management.showAll();
函数
// Function: Show all results on page
app.showAll = function() {
app.limit = undefined; // Clear ng-repeat limit
app.showMoreError = false; // Clear error message
};
<script src="//unpkg.com/angular/angular.js"></script>
<body ng-app ng-init="value='0'">
<input type="text" ng-model="value" />value={{value}}<br>
<div ng-show="value=='0'">
Input is "0"
</div>
</body>
我有这个功能可以搜索数据库
app.limit = 5; // Set a default limit to ng-repeat
app.searchLimit = 0; // Set the default search page results limit to zero
app.search = function(searchKeyword, number) {
// Check if a search keyword was provided
if (searchKeyword) {
// Check if the search keyword actually exists
if (searchKeyword.length > 0) {
app.limit = 0; // Reset the limit number while processing
$scope.searchFilter = searchKeyword; // Set the search filter to the word provided by the user
app.limit = number; // Set the number displayed to the number entered by the user
} else {
$scope.searchFilter = undefined; // Remove any keywords from filter
app.limit = 0; // Reset search limit
}
} else {
$scope.searchFilter = undefined; // Reset search limit
app.limit = 0; // Set search limit to zero
}
};
以及使用搜索功能的输入。每次用户按下一个键,table 过滤器
<input type="text" class="form-control" name="search"
placeholder="search for..."
ng-model="searchKeyword"
ng-keyup="management.search(searchKeyword, number);">
问题是当我退格所有字符串并且没有输入时,tables 不显示任何数据,有什么方法可以检测输入是否为 = 0 以便我可以使用我的函数 management.showAll();
函数
// Function: Show all results on page
app.showAll = function() {
app.limit = undefined; // Clear ng-repeat limit
app.showMoreError = false; // Clear error message
};
<script src="//unpkg.com/angular/angular.js"></script>
<body ng-app ng-init="value='0'">
<input type="text" ng-model="value" />value={{value}}<br>
<div ng-show="value=='0'">
Input is "0"
</div>
</body>