Non
Non

Reputation: 8589

removing a class once a function is called

I am new to Angular and I am not sure if I can perform this from the html

<td ng-class="{'lines-hover': !row.noSpread,
               'line-selected': row.spreadSelected}"></td>

I have those classes there, the class that I want to remove is the one named line-selected once this function is called

<button ng-click="removeAllSlips()">Remove All</button>

both belongs to different controllers, all I need is that once I play with that button, that class must be remove, what are your suggestions ?

Upvotes: 1

Views: 29

Answers (1)

Alaksandar Jesus Gene
Alaksandar Jesus Gene

Reputation: 6883

<td ng-class="{'lines-hover': !row.noSpread,
               row.spreadSelected?'line-selected':''}"></td>

Controller

function removeAllSlips(){
 $scope.row.spreadSelected = false;
}

Try this. Not sure it might affect other rows also.

Upvotes: 1

Related Questions