0
Это функция, которую я добавил в localcacheService. Я хочу добавить эту функцию в директиву.Как добавить определенную функцию из службы в директиву в AngularJS
LocalCacheServiceClear.prototype.isAvailable = function() {
this.cache.clear();
}
Моя директива это:
(function() {
var MainApp = angular.module('MainApp');
MainApp.directive('Logout', function() {
return {
'restrict': 'E',
'templateUrl': 'directives/panels/Logout.html',
'controller': ["$scope","LocalCacheService", function($scope,LocalCacheService) {
console.log("Logout Controller called....");
$scope.Logout = function() {
window.sessionStorage.clear();
console.log('Log out');
}
}]
};
});
}());
Как добавить эту функцию в этой директиве?