AngularJS Example
HTML
<div ng-app="app">
<div ng-controller="ParentCtrl">
<a data-ng-click-once="myFunction()">click me</a>
</div>
</div>
CSS
</style>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.css"/>
<style>
JavaScript
angular.module('app', [])
.directive("ngClickOnce", function(){
return {
restrict: "A",
link: function(scope, element, attribute){
var clickFunction = function(){
scope.$eval(attribute.ngClickOnce);
scope.$apply();
element.unbind("click", clickFunction);
};
element.bind("click", clickFunction);
}
};
});
function ParentCtrl($scope){
$scope.myFunction = function(){
alert(1);
}
}