Aro Tonoyan Aro Tonoyan -4 years ago 55
AngularJS Question

Show {{ value }} except special one in AngularJS 1.6

After SPAN click my DIV get this category title , but in one case , when category.title is 'Favorite' (or category.id = '1',its the same) i need ignore it in DIV and don't change the value on it.

How can i realize that ?
Thanks in advance

My HTML :

<div> {{ selections.category.title }} </div>
<span ng-repeat="category in categories track by category.id" ng-click="selectCategory(category)">
...
</span>


My controller :

$scope.selectCategory = function selectCategory(category) {
$scope.selections.category = category;
...
}


EDIT.

I need only ignore it in DIV's text , not ignore click on this element .

Answer Source
<div> {{ selectedTitle  }} </div>

$scope.selectCategory = function selectCategory(category) {
  if(category.title !== 'Favorite' && category.id !== '1') {
   $scope.selectedTitle = category.title;
  }
  $scope.selections.category = category;
  ...      
}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download