【发布时间】:2016-05-20 11:01:28
【问题描述】:
这是我在localcacheService中添加的一个功能。 我想在指令中添加这个函数。
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');
}
}]
};
});
}());
如何将此函数添加到该指令中?
【问题讨论】:
标签: angularjs angularjs-directive angularjs-service