progressEditor.directive.js 754 B

123456789101112131415161718192021222324252627282930313233
  1. angular.module('kityminderEditor')
  2. .directive('progressEditor', ['commandBinder', function(commandBinder) {
  3. return {
  4. restrict: 'E',
  5. templateUrl: 'ui/directive/progressEditor/progressEditor.html',
  6. scope: {
  7. minder: '='
  8. },
  9. replace: true,
  10. link: function($scope) {
  11. var minder = $scope.minder;
  12. var progresses = [];
  13. for (var i = 0; i < 10; i++) {
  14. progresses.push(i);
  15. }
  16. commandBinder.bind(minder, 'progress', $scope);
  17. $scope.progresses = progresses;
  18. $scope.getProgressTitle = function(p) {
  19. switch(p) {
  20. case 0: return '移除进度';
  21. case 1: return '未开始';
  22. case 9: return '全部完成';
  23. default: return '完成' + (p - 1) + '/8';
  24. }
  25. }
  26. }
  27. }
  28. }])