Hide button after ng-click event

13 views
Skip to first unread message

Bonge LaBwana

unread,
May 10, 2018, 2:12:56 AM5/10/18
to Angular and AngularJS discussion

Hii guys.
I have event for deleting data  when user clicks X icon for deleting data, data are deleted succesfully and displays status
DELETED, remember the default status is UNDELETED, what I want is when status is DELETED the X icon for deleting data should be 
hidden but if its not deleted X icon should be visible.

here is what I have done so far

<!DOCTYPE html>
<html>
<body>

<div ng-app="myApp" ng-controller="myCtrl">

<a ng-click =vm.deleteData() <i class="fa fa-times><i>
<label ng-show="vm.isVisible"> {{dataStatus}}</label>

</div>

<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
   vm.isVisible =false;
   $scope.deleteData = function()
    {
    if(vm.dataStatus !== "DELETED")
    {
    vm.isVisible = true;
    }
    else
    {
    vm.isVisible = false
    }
    
    };
});
</script>

This just hide X icon , what wrong am I doing here?  help please

khushbu poddar

unread,
May 22, 2018, 9:10:03 AM5/22/18
to Angular and AngularJS discussion
<a ng-click =vm.deleteData() ng-if="dataStatus === 'UNDELETED'"><i class="fa fa-times><i></a>


Reply all
Reply to author
Forward
0 new messages