Here is the code snippet from the view :
<input type="radio" name="tabset" id="tab2" aria-controls="rauchbier"
ng-checked="switch_tabs()">
And in the controller, we have:
$scope.switch_tabs = function(){
console.log(notification_form_data);
console.log($('#notification_form').serialize());
if (notification_form_data != $('#notification_form').serialize() && notification_form_data!= undefined)
{
var alertPopup = $ionicPopup.alert({
title: 'vs',
template: 'unsaved data in actions',
button: 'Done'
});
}
The alert prompt and console.log are triggered 100 times when a certain condition is met. How can we make it trigger only once?