Commit 8ff26d118ed03bced2eeb00cdd0323ad8de8220b
1 parent
6a07416f92
Exists in
master
uso factory, fuera inyecciones
Showing
3 changed files
with
2 additions
and
3 deletions
Show diff stats
gulpfile.js
1 | const templateCache = require('gulp-angular-templatecache'); | 1 | const templateCache = require('gulp-angular-templatecache'); |
2 | const concat = require('gulp-concat'); | 2 | const concat = require('gulp-concat'); |
3 | const htmlmin = require('gulp-htmlmin'); | 3 | const htmlmin = require('gulp-htmlmin'); |
4 | const rename = require('gulp-rename'); | 4 | const rename = require('gulp-rename'); |
5 | const uglify = require('gulp-uglify'); | 5 | const uglify = require('gulp-uglify'); |
6 | const gulp = require('gulp'); | 6 | const gulp = require('gulp'); |
7 | const pump = require('pump'); | 7 | const pump = require('pump'); |
8 | const jshint = require('gulp-jshint'); | 8 | const jshint = require('gulp-jshint'); |
9 | const replace = require('gulp-replace'); | 9 | const replace = require('gulp-replace'); |
10 | const connect = require('gulp-connect'); | 10 | const connect = require('gulp-connect'); |
11 | const clean = require('gulp-clean'); | 11 | const clean = require('gulp-clean'); |
12 | 12 | ||
13 | var paths = { | 13 | var paths = { |
14 | srcJS: 'src/js/*.js', | 14 | srcJS: 'src/js/*.js', |
15 | srcViews: 'src/views/*.html', | 15 | srcViews: 'src/views/*.html', |
16 | tmp: 'tmp', | 16 | tmp: 'tmp', |
17 | dist: 'dist/' | 17 | dist: 'dist/' |
18 | }; | 18 | }; |
19 | 19 | ||
20 | gulp.task('templates', function() { | 20 | gulp.task('templates', function() { |
21 | return pump( | 21 | return pump( |
22 | [ | 22 | [ |
23 | gulp.src(paths.srcViews), | 23 | gulp.src(paths.srcViews), |
24 | replace('views/', ''), | 24 | replace('views/', ''), |
25 | htmlmin(), | 25 | htmlmin(), |
26 | templateCache('views.js', { | 26 | templateCache('views.js', { |
27 | module: 'focaModalResumenCuenta', | 27 | module: 'focaModalResumenCuenta', |
28 | root: '' | 28 | root: '' |
29 | }), | 29 | }), |
30 | gulp.dest(paths.tmp) | 30 | gulp.dest(paths.tmp) |
31 | ] | 31 | ] |
32 | ); | 32 | ); |
33 | }); | 33 | }); |
34 | 34 | ||
35 | gulp.task('uglify', ['templates'], function() { | 35 | gulp.task('uglify', ['templates'], function() { |
36 | return pump( | 36 | return pump( |
37 | [ | 37 | [ |
38 | gulp.src([ | 38 | gulp.src([ |
39 | paths.srcJS, | 39 | paths.srcJS, |
40 | 'tmp/views.js' | 40 | 'tmp/views.js' |
41 | ]), | 41 | ]), |
42 | concat('foca-modal-resumen-cuenta.js'), | 42 | concat('foca-modal-resumen-cuenta.js'), |
43 | replace('src/views/', ''), | 43 | replace('src/views/', ''), |
44 | replace("['ui.bootstrap']", '[]'), | ||
45 | gulp.dest(paths.tmp), | 44 | gulp.dest(paths.tmp), |
46 | rename('foca-modal-resumen-cuenta.min.js'), | 45 | rename('foca-modal-resumen-cuenta.min.js'), |
47 | uglify(), | 46 | uglify(), |
48 | gulp.dest(paths.dist) | 47 | gulp.dest(paths.dist) |
49 | ] | 48 | ] |
50 | ); | 49 | ); |
51 | }); | 50 | }); |
52 | 51 | ||
53 | gulp.task('pre-commit', function() { | 52 | gulp.task('pre-commit', function() { |
54 | return pump( | 53 | return pump( |
55 | [ | 54 | [ |
56 | gulp.src(paths.srcJS), | 55 | gulp.src(paths.srcJS), |
57 | jshint('.jshintrc'), | 56 | jshint('.jshintrc'), |
58 | jshint.reporter('default'), | 57 | jshint.reporter('default'), |
59 | jshint.reporter('fail') | 58 | jshint.reporter('fail') |
60 | ] | 59 | ] |
61 | ); | 60 | ); |
62 | 61 | ||
63 | gulp.start('uglify'); | 62 | gulp.start('uglify'); |
64 | }); | 63 | }); |
65 | 64 | ||
66 | gulp.task('webserver', function() { | 65 | gulp.task('webserver', function() { |
67 | pump [ | 66 | pump [ |
68 | connect.server({port: 3000}) | 67 | connect.server({port: 3000}) |
69 | ] | 68 | ] |
70 | }); | 69 | }); |
71 | 70 | ||
72 | gulp.task('clean-post-install', function(){ | 71 | gulp.task('clean-post-install', function(){ |
73 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | 72 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', |
74 | 'index.html'], {read: false}) | 73 | 'index.html'], {read: false}) |
75 | .pipe(clean()); | 74 | .pipe(clean()); |
76 | }); | 75 | }); |
77 | 76 | ||
78 | gulp.task('default', ['webserver']); | 77 | gulp.task('default', ['webserver']); |
79 | 78 | ||
80 | gulp.task('watch', function() { | 79 | gulp.task('watch', function() { |
81 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']) | 80 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']) |
82 | }); | 81 | }); |
83 | 82 |
src/js/app.js
1 | angular.module('focaModalResumenCuenta', ['ui.bootstrap']); | 1 | angular.module('focaModalResumenCuenta', []); |
2 | 2 |
src/js/service.js
1 | angular.module('focaModalResumenCuenta') | 1 | angular.module('focaModalResumenCuenta') |
2 | .service('focaModalResumenCuentaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { | 2 | .factory('focaModalResumenCuentaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { |
3 | return { | 3 | return { |
4 | getResumenCuenta: function(idCliente, fechaDesde) { | 4 | getResumenCuenta: function(idCliente, fechaDesde) { |
5 | return $http.get(API_ENDPOINT.URL + | 5 | return $http.get(API_ENDPOINT.URL + |
6 | '/factura/resumen/' + idCliente + '/' + fechaDesde); | 6 | '/factura/resumen/' + idCliente + '/' + fechaDesde); |
7 | }, | 7 | }, |
8 | enviarFacturaPorMail: function(receiver, factura) { | 8 | enviarFacturaPorMail: function(receiver, factura) { |
9 | return $http.post(API_ENDPOINT.URL + '/mail', | 9 | return $http.post(API_ENDPOINT.URL + '/mail', |
10 | {receiver: receiver, factura: factura}); | 10 | {receiver: receiver, factura: factura}); |
11 | }, | 11 | }, |
12 | enviarResumenPorMail: function(receiver, resumen) { | 12 | enviarResumenPorMail: function(receiver, resumen) { |
13 | return $http.post(API_ENDPOINT.URL + '/mail/resumen-cuenta', | 13 | return $http.post(API_ENDPOINT.URL + '/mail/resumen-cuenta', |
14 | {receiver: receiver, resumen: resumen}); | 14 | {receiver: receiver, resumen: resumen}); |
15 | } | 15 | } |
16 | }; | 16 | }; |
17 | }]); | 17 | }]); |
18 | 18 |