Guest User

Untitled

a guest
Jan 19th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. //Other html codes and scripts here layout.html
  2. <div ui-view>
  3.  
  4. </div>
  5.  
  6. var myApp = angular.module('myApp', ['ui.router', 'angular-loading-bar', 'ngAnimate', 'ngFlash', 'angularSpinner', 'oitozero.ngSweetAlert'])
  7. .config(function (cfpLoadingBarProvider) {
  8. cfpLoadingBarProvider.includeSpinner = true;
  9. })
  10.  
  11. myApp.directive('fileModel', ['$parse', function ($parse) {
  12. return {
  13. restrict: 'A',
  14. link: function (scope, element, attrs) {
  15. var model = $parse(attrs.fileModel);
  16. var modelSetter = model.assign;
  17.  
  18. element.bind('change', function () {
  19. scope.$apply(function () {
  20. modelSetter(scope, element[0].files[0]);
  21. });
  22. });
  23. }
  24. };
  25. }]);
  26.  
  27. // myapp.config(['usSpinnerConfigProvider', function (usSpinnerConfigProvider) {
  28. // usSpinnerConfigProvider.setDefaults({color: 'blue'});
  29. // }]);
  30.  
  31. myApp.config(['$stateProvider', '$urlRouterProvider', '$locationProvider', 'FlashProvider', 'usSpinnerConfigProvider', function ($stateProvider, $urlRouterProvider, $locationProvider, FlashProvider, usSpinnerConfigProvider) {
  32. // $locationProvider.hashPrefix('');
  33. usSpinnerConfigProvider.setTheme('bigBlue', {color: 'green', radius: 20});
  34. usSpinnerConfigProvider.setTheme('smallRed', {color: 'red', radius: 6});
  35. FlashProvider.setTemplate(`
  36. <div class="my-flash">{{ flash.text }}</div>
  37. `);
  38.  
  39. $locationProvider.html5Mode(true);
  40. $stateProvider
  41.  
  42. //route for the homepage
  43. .state('index', {
  44. url: '/',
  45. data: {
  46. pageTitle: 'Homepage'
  47. },
  48. templateUrl: '../views/index.html',
  49. controller: 'mainController'
  50. })
  51.  
  52. .state('product', {
  53. url: '/product',
  54. data: {
  55. pageTitle: 'Product'
  56. },
  57. templateUrl: '../views/product.html',
  58. controller: 'mainController'
  59. })
  60.  
  61. //other state codes fall here
Add Comment
Please, Sign In to add comment