harbor/static/ng/resources/js/components/details/switch-pane-projects.directive.js
2016-05-02 01:46:50 +08:00

60 lines
1.2 KiB
JavaScript

(function() {
'use strict';
angular
.module('harbor.details')
.directive('switchPaneProjects', switchPaneProjects);
SwitchPaneProjectsController.$inject = ['$scope'];
function SwitchPaneProjectsController($scope) {
var vm = this;
$scope.$on('isOpen', function(e, val){
vm.isOpen = val;
});
$scope.$watch('vm.selectedProject', function(current, origin) {
if(current){
vm.projectName = current.Name;
vm.selectedProject = current;
}
});
vm.switchPane = switchPane;
function switchPane() {
if(vm.isOpen) {
vm.isOpen = false;
}else{
vm.isOpen = true;
}
}
}
function switchPaneProjects() {
var directive = {
restrict: 'E',
templateUrl: '/static/ng/resources/js/components/details/switch-pane-projects.directive.html',
replace: true,
scope: {
'selectedProject': '=',
'isOpen': '='
},
link: link,
controller: SwitchPaneProjectsController,
controllerAs: 'vm',
bindToController: true
}
return directive;
function link(scope, element, attrs, ctrl) {
}
}
})();