В настоящий момент мой код работает, если просмотр загружается, и в поле ввода нет фокуса. Div скрыт с помощью этого кода:
<i class="icon ion-search placeholder-icon"></i>
<input type="text" placeholder="Solothurn durchsuchen..." name="text" ng-model="searchBox.storeName">
</label>
<br><br>
<div ng-repeat="item in posts | filter:searchBox" class="card has-header" ng-show="searchBox">
<div class="w shop">{{item.storeName}}</div>
<p class="w">
Но моя цель состоит в том, что когда пользователь удаляет текст в поле ввода, divs снова скрываются. Как я могу это сделать? Любая помощь очень ценится!
просто используйте ng-show="searchBox.storeName.length > 0"
и это будет ng-show="searchBox.storeName.length > 0"
вашей целью
<div ng-repeat="item in posts | filter:searchBox" class="card has-header" ng-if="searchBox.storeName != null">
ИЛИ
<div ng-repeat="item in posts | filter:searchBox" class="card has-header" ng-if="searchBox.storeName">
попробуй это
<i class="icon ion-search placeholder-icon"></i>
<input type="text" placeholder="Solothurn durchsuchen..." name="text" ng-model="searchBox.storeName">
</label>
<br><br>
<div ng-repeat="item in posts | filter:searchBox" class="card has-header" ng-show="searchBox.storeName">
<div class="w shop">{{item.storeName}}</div>
<p class="w">
ng-show="searchBox.storeName"
ng-show
использующаяsearchBox.storeName.length
?