Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2015
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. app
  2. - Orders
  3. -orders.html
  4. -OrderController.js
  5. -OrderService.js
  6.  
  7. var myApp = angular.module('myApp', ['ngRoute','ngAnimate','ui.bootstrap','myApp.OrderController']);
  8. myApp.config(function($routeProvider, $locationProvider){
  9. $locationProvider.html5Mode({
  10. enabled: true,
  11. requireBase: false
  12. });
  13. $routeProvider
  14. .when('/orders', {
  15. templateUrl: 'orders/orders.html',
  16. controller: 'OrderController',
  17. resolve:{
  18. customerExpenses: function(OrderService){
  19. return OrderService.getOrders($route.current.params.customerName);
  20. }
  21. }
  22. })
  23. })
  24.  
  25. angular.module('myApp').factory('OrderService', ['$http', function($http) {
  26. var sdo = {
  27. getNames: function() {
  28. var promise = $http({
  29. method: 'GET',
  30. url: ''
  31. });
  32. promise.success(function(data, status, headers, conf) {
  33. return data;
  34. });
  35. return promise;
  36. }
  37. }
  38. return sdo;
  39. }]);
  40.  
  41. angular.module('myApp')
  42. .service('FooService', function(){
  43. //...etc
  44. })
  45. .config(function(FooServiceProvider){
  46. //...etc
  47. });
  48.  
  49. angular.module('myApp.OrderController',[]).controller('OrderController', function ($scope) {
  50. $scope.displayed=[];
  51. $scope.displayed.push(OrderService.getNames());
  52. });
  53.  
  54. angular.module('myApp.OrderController',[]).controller('OrderController', ['$scope','OrderService',function ($scope) {
  55. $scope.displayed=[];
  56. $scope.displayed.push(OrderService.getNames());
  57. }]);
  58.  
  59. angular.
  60. module('myServiceModule', []).
  61. controller('MyController', ['$scope','notify', function ($scope, notify) {
  62. $scope.callNotify = function(msg) {
  63. notify(msg);
  64. };
  65. }]).
  66. factory('notify', ['$window', function(win) {
  67. var msgs = [];
  68. return function(msg) {
  69. msgs.push(msg);
  70. if (msgs.length == 3) {
  71. win.alert(msgs.join("n"));
  72. msgs = [];
  73. }
  74. };
  75. }]);
  76.  
  77. var myApp = angular.module('myApp', ['ngRoute','ngAnimate', ....'OrderService'])
  78. myApp.config(function($routeProvider, $locationProvider, OrderService){
  79. ....
  80. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement