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

app.js 1.9KB

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