I have the following chip with materialize:
<div class="chip">
tag
<i class="close material-icons" ng-click="hide_chip(this)">close</i>
</div>
my controller:
$scope.hide_chip = function(elem){
var r = confirm("Are you sure?");
if (r == true) {
var chip = elem.parentNode;
chip.style.display = 'none';
}
}
I want to know how to show an alert when user clicks the close icon?
the alert should have yes or no button if it is yes the chip close, but if user click no the chip does not close
My error is “chip is undefined”, and when r is false the chip disappears
Someone can help me? thanks
Source: AngularJS
from Angular Questions https://angularquestions.com/2017/10/19/alert-after-click-chip-in-materialize-in-angularjs/
via @lzomedia #developer #freelance #web #lzomedia.com
No comments:
Post a Comment