您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

app.js 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. 'use strict';
  2. /* App Module */
  3. var app = angular.module('app', [
  4. 'ui.bootstrap',
  5. 'ui.router',
  6. 'LocalStorageModule',
  7. 'ngAria',
  8. 'ngAnimate',
  9. 'ngMaterial',
  10. 'appSdk'
  11. ]);
  12. app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', '$locationProvider',
  13. function($stateProvider, $urlRouterProvider, $httpProvider, $locationProvider) {
  14. //$locationProvider.html5Mode(true);
  15. $stateProvider.state('home',{
  16. url:'/',
  17. reloadOnSearch: false,
  18. templateUrl:'views/home.html',
  19. controller:'HomeController'
  20. });
  21. $urlRouterProvider.otherwise('/');
  22. }])
  23. .directive('dateNow', ['$filter', function($filter) {
  24. return {
  25. link: function( $scope, $element, $attrs) {
  26. $element.text($filter('date')(new Date(), $attrs.dateNow));
  27. }
  28. };
  29. }])
  30. .run(['$rootScope', '$state', '$location', 'DataShareBusiness', 'GroupsBusiness',
  31. function ($rootScope, $state, $location, DataShareBusiness, GroupsBusiness) {
  32. $rootScope.$on('$stateChangeError', function (e, curr, prev) {
  33. //$state.go('/');
  34. });
  35. $rootScope.$watch(function(){ return Object.keys($location.search())[0] }, function(){
  36. if (DataShareBusiness.Groups != null) {
  37. DataShareBusiness.setFromSearchString(Object.keys($location.search())[0]);
  38. }
  39. });
  40. var promiseLoadGroups = {
  41. id: "promiseLoadGroups",
  42. loaderGroups: ["toolbar"],
  43. groups: ["sidebar"]
  44. };
  45. GroupsBusiness.loadAll(promiseLoadGroups).then(function(data)
  46. {
  47. DataShareBusiness.setFromSearchString(Object.keys($location.search())[0]);
  48. });
  49. }]);