Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app
- - Orders
- -orders.html
- -OrderController.js
- -OrderService.js
- var myApp = angular.module('myApp', ['ngRoute','ngAnimate','ui.bootstrap','myApp.OrderController']);
- myApp.config(function($routeProvider, $locationProvider){
- $locationProvider.html5Mode({
- enabled: true,
- requireBase: false
- });
- $routeProvider
- .when('/orders', {
- templateUrl: 'orders/orders.html',
- controller: 'OrderController',
- resolve:{
- customerExpenses: function(OrderService){
- return OrderService.getOrders($route.current.params.customerName);
- }
- }
- })
- })
- angular.module('myApp').factory('OrderService', ['$http', function($http) {
- var sdo = {
- getNames: function() {
- var promise = $http({
- method: 'GET',
- url: ''
- });
- promise.success(function(data, status, headers, conf) {
- return data;
- });
- return promise;
- }
- }
- return sdo;
- }]);
- angular.module('myApp')
- .service('FooService', function(){
- //...etc
- })
- .config(function(FooServiceProvider){
- //...etc
- });
- angular.module('myApp.OrderController',[]).controller('OrderController', function ($scope) {
- $scope.displayed=[];
- $scope.displayed.push(OrderService.getNames());
- });
- angular.module('myApp.OrderController',[]).controller('OrderController', ['$scope','OrderService',function ($scope) {
- $scope.displayed=[];
- $scope.displayed.push(OrderService.getNames());
- }]);
- angular.
- module('myServiceModule', []).
- controller('MyController', ['$scope','notify', function ($scope, notify) {
- $scope.callNotify = function(msg) {
- notify(msg);
- };
- }]).
- factory('notify', ['$window', function(win) {
- var msgs = [];
- return function(msg) {
- msgs.push(msg);
- if (msgs.length == 3) {
- win.alert(msgs.join("n"));
- msgs = [];
- }
- };
- }]);
- var myApp = angular.module('myApp', ['ngRoute','ngAnimate', ....'OrderService'])
- myApp.config(function($routeProvider, $locationProvider, OrderService){
- ....
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement