angularjs ng-show not working when ng-click -
<div role="tabpanel" class="tab-pane active" id="personnes"> <div infinite-scroll='redditusers.nextpage()' infinite-scroll-disabled='redditusers.busy' infinite-scroll-distance='3' > <div class="search-item row" ng-init="request=false" ng-repeat="user in redditusers.users" > <div class=" pull-left"> <img ng-src="{{notif.subscriber.avatar == 'no_avatar' && '/images/default.svg' || 'http://localhost:85/api.immortality.life/application/uploads/avatars/'+user.id_user+'/'+user.avatar }}" class="edit-img"> <span>{{user.first_name+' '+user.last_name}}</span> </div> <div class="pull-right" > <button ng-if="user.friend == null && request==false" ng-hide="request" ng-click="addfriend($event,user);request=true;" class="add-btn btn"><i class=" icon-friends s"></i>ajouter</button> <span ng-show="request" class="add-btn btn"><i class=" icon-friends s"></i>demande envoyée</span> <span ng-if="user.friend != null " class="add-btn btn"><i class=" icon-friends s"></i></span> </div> </div> <div ng-show='redditusers.busy'>loading data...</div> </div> </div>
the problem when click button first span dont show despite of made ng-show="request"
change ng-click to:
ng-click="addfriend($event,user);setrequest(true);"
in js file
$scope.setrequest = setrequest; function setrequest(val){ $scope.request = val; }
Comments
Post a Comment