У меня есть эта функция для поиска в базе данных
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
}
};
И вход для использования функции поиска.Каждый раз, когда пользователь нажимает клавишу, таблица фильтрует
<input type="text" class="form-control" name="search"
placeholder="search for..."
ng-model="searchKeyword"
ng-keyup="management.search(searchKeyword, number);">
Проблема в том, что когда я возвращаю все строки и нет ввода, в таблицах нет данных, есть ли способ определить, является ли ввод =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
};