選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

app.js 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. 'use strict';
  2. /* App Module */
  3. angular.module('app', [
  4. 'ui.bootstrap',
  5. 'ui.router',
  6. 'LocalStorageModule',
  7. 'ngMaterial',
  8. 'dialogs.main',
  9. 'luticateAuth',
  10. 'luticateUtils',
  11. 'appSdk'
  12. ])
  13. .config(['$stateProvider', '$urlRouterProvider', '$compileProvider', '$httpProvider',
  14. function($stateProvider, $urlRouterProvider, $compileProvider, $httpProvider) {
  15. $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|data):/);
  16. $stateProvider.state('root', {
  17. abstract: true,
  18. template: '<div ui-view=""></div>',
  19. resolve: ['luticateAuthUsers', function(luticateAuthUsers)
  20. {
  21. return luticateAuthUsers.loadUserData(null);
  22. }]
  23. });
  24. $stateProvider.state('images', {
  25. url:'/',
  26. parent: 'root',
  27. title: "Images",
  28. templateUrl:'views/images.html',
  29. controller:'ImagesController'
  30. });
  31. $stateProvider.state('login', {
  32. url:'/login',
  33. parent: 'root',
  34. title: "Login",
  35. templateUrl:'views/login.html',
  36. controller:'LoginController'
  37. });
  38. $stateProvider.state('signUp', {
  39. url:'/signUp',
  40. parent: 'root',
  41. title: "Sign Up",
  42. templateUrl:'views/signup.html',
  43. controller:'SignUpController'
  44. });
  45. $stateProvider.state('upload', {
  46. url:'/upload',
  47. parent: 'root',
  48. title: "Upload",
  49. templateUrl:'views/upload.html',
  50. controller:'UploadController'
  51. });
  52. /*$stateProvider.state('images', {
  53. url:'/images',
  54. parent: 'root',
  55. title: "Images",
  56. templateUrl:'views/images.html',
  57. controller:'ImagesController'
  58. });*/
  59. $urlRouterProvider.otherwise('/');
  60. $httpProvider.interceptors.push(['luticateAuthCache', '$injector', '$q',
  61. function (luticateAuthCache, $injector, $q) {
  62. return {
  63. 'request': function (config) {
  64. var token = luticateAuthCache.getToken();
  65. if (token != null)
  66. config.headers['X-Authorization'] = token;
  67. return config;
  68. },
  69. 'responseError': function(rejection) {
  70. return $q.reject(rejection);
  71. }
  72. };
  73. }]);
  74. }])
  75. .directive('dateNow', ['$filter', function($filter) {
  76. return {
  77. link: function( $scope, $element, $attrs) {
  78. $element.text($filter('date')(new Date(), $attrs.dateNow));
  79. }
  80. };
  81. }])
  82. .run(['$rootScope', '$state',
  83. function ($rootScope, $state) {
  84. $rootScope.$on('$stateChangeSuccess', function (event, current, previous) {
  85. $rootScope.title = current.title + " - 420px";
  86. });
  87. }]).filter("toDataUrl", function() {
  88. return function (data) {
  89. return "data:image/*;base64," + btoa(data);
  90. }
  91. });