There is a lock and unlock functionality, which in html is represented by
<li><a ng:click="lock(selectedUser)"><i class="icon-lock icon"></i>Lock</a></li>
and
<li><a ng:click="unlock(selectedUser)"><i class="icon-unlock icon"></i>UnLock</a></li>
Unlock/Lock is acutally a REST API call
$scope.unlock = function(user){
user.$unlock();
}
$scope.lock = function(user){
user.$lock();
}
How can I toggle between the two states in angular.js? I mean when a lock is performed and is successfull the first option should be hidden while the unlock button should get visible.
selectedUser.enabled
returns 1 for unlocked and 0 for locked.