一个基于angular的视图权限指令
- angular
html代码
<body ng-app="app" ng-controller="ctrl">
<button has-permission="edit">权限按钮</button>
</body>
angular代码
var app = angular.module("app", ["ngPermission"]);
var data = ["add", "edit"];
app.config(["ngPermissionProvider", function(ngPermissionProvider) {
ngPermissionProvider.setData(data);
}]);
app.controller("ctrl", ["$scope", function($scope) {
}]);