0
Hello.
I have the following filter:
<div ng-repeat="user in users|filter:search| filter:selectedCategories| filter:selectedType| filter:selectedDate| orderBy:'+id':true| limitTo: 10">
You want to put the "Last users" text when the page is loaded and I want it not to appear when the user uses the filter.
Any idea?
Edit:
<div ng-app="testeApp">
<script>
var myApp = angular.module('testeApp',[]);
myApp.controller('testeController', function($scope){
$scope.users=[
{id:1, name:"Fulano", startdate:'janeiro', categories:'normal', type:'xpto'},
];
});
</script>
</div>
<form>
<input type="text" ng-model="search" class="text-input" placeholder="Nome, Cidade, País, Continente" autofocus />
<select ng-model="selectedCategories">
<option value="">-- Categoria --</option>
<option value='normal'>Normal</option>
</select>
<select class="type" ng-model="selectedType">
<option value="">-- Tipo --</option>
<option value='xpto'>xpto</option>
</select>
<select class="data" ng-model="selectedDate">
<option value="">-- Data --</option>
<option value="janeiro">janeiro</option>
<option value="fevereiro">fevereiro</option>
</select>
</form>
<h3 ng-if="!search">Últimos usuários adicionados</h3>
<span ng-if="!!search">Últimos usuários</span>
?– OnoSendai
thanks for the answer, it worked like this:
<span ng-if="!search">Últimos usuários</span>
Now, how do I make the same thing happen to other filters? I tried using OR<span ng-if="!search || !selectedCategories || !selectedType || !selectedDate">Últimos usuários</span>
and it didn’t work– carlostiago
I will confess that it was in the kick (calculated, but kick. = ) ). That’s because I assumed that
search
was just an object. IfselectedCategories
, for example, it is a registered object (an angular filter) that mechanical might not work. You could post a little more of your code?– OnoSendai
@carlostiago You can [Dit] your publication and add this type of information to it. In addition to being more readable and better formatted, comments serve another purpose.
– Jéf Bueno