(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| angular.module('myMdl', []).config(['$httpProvider', function($httpProvider) { | |
| $httpProvider.responseInterceptors.push([ | |
| '$q', '$templateCache', 'activeProfile', | |
| function($q, $templateCache, activeProfile) { | |
| // Keep track which HTML templates have already been modified. | |
| var modifiedTemplates = {}; | |
| // Tests if there are any keep/omit attributes. | |
| var HAS_FLAGS_EXP = /data-(keep|omit)/; |
| { | |
| "name": "countries-app", | |
| "version": "0.1.0", | |
| "description": "", | |
| "main": "index.js", | |
| "scripts": { | |
| "test": "echo \"Error: no test specified\" && exit 1" | |
| }, | |
| "repository": { | |
| "type": "git", |
| import request from 'request-promise'; | |
| var token = process.env.SBIF_TOKEN_URL, | |
| api_url = process.env.SBIF_API_URL; | |
| class SbifApi{ | |
| constructor(SbifModel){ | |
| //map remote methods to class methods. Set an extra this using the .bind function | |
| SbifModel.uf = this.getData.bind(SbifModel, 'uf'); | |
| SbifModel.utm = this.getData.bind(SbifModel, 'utm'); |
| module.exports = function(Sbif) { | |
| var request = require('request-promise'), | |
| token = process.env.SBIF_TOKEN_URL, | |
| api_url = process.env.SBIF_API_URL; | |
| // UTM --------------------------------------------- | |
| Sbif.utm = function(params, cb) { | |
| makeRequest('utm',{}).then(function(res) { | |
| cb(null, JSON.parse(res).UTMs[0]); |
| import request from 'request-promise'; | |
| var token = process.env.SBIF_TOKEN_URL, | |
| api_url = process.env.SBIF_API_URL; | |
| class SbifApi{ | |
| constructor(SbifModel){ | |
| //map remote methods to class methods. Set an extra this using the .bind function | |
| SbifModel.uf = this.getData.bind(SbifModel, 'uf'); | |
| SbifModel.utm = this.getData.bind(SbifModel, 'utm'); |
| import request from 'request-promise'; | |
| var token = process.env.SBIF_TOKEN_URL, | |
| api_url = process.env.SBIF_API_URL; | |
| class SbifApi{ | |
| constructor(SbifModel){ | |
| //map remote methods to class methods. Set an extra this using the .bind function | |
| SbifModel.uf = this.getData.bind(SbifModel, 'uf'); | |
| SbifModel.utm = this.getData.bind(SbifModel, 'utm'); |
| (function(){ | |
| 'use strict'; | |
| angular | |
| .module('MedicionAguaAdmin') | |
| .service('AuthService', Service); | |
| Service.$inject = ['$resource','$cookies','APP_SETTINGS']; | |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| { | |
| "name": "angularjs-tdd-jest", | |
| "version": "0.1.0", | |
| "scripts": { | |
| "start": "webpack-dev-server", | |
| "test": "cross-env NODE_PATH=./src jest --coverage --verbose", | |
| "tdd": "cross-env NODE_PATH=./src jest --watch --verbose", | |
| "check-coverage": "npm test | http-server -so -p 9000 coverage/lcov-report" | |
| }, | |
| "dependencies": { |
| { | |
| "presets": [ | |
| "es2015", | |
| "stage-3" | |
| ] | |
| } |