I want to call close() function on click anywhere in page,but didn't work. I have written like:
var liveSearch = function () {
return {
restrict: "A",
scope: {
myData: '=',
ngModel: '='
},
templateUrl: "/js/app/common/template/livesearch.html",
link: function ($scope, element, attrs) {
var close = function() {
$scope.status = "close";
};
$scope.open = function () {
$scope.status = "open";
};
$(document).on('click',function(){
close();
});
}
};
app.directive("liveSearch", liveSearch);
Please help to solve this problem.
Edited
<div live-search my-data="data" ng-model="typeId" ></div>