Skip to content

Instantly share code, notes, and snippets.

@rkunboxed
rkunboxed / data-service.js
Created December 15, 2015 17:19 — forked from paul-barry-kenzan/data-service.js
Mocking $resource based service with custom method which is called on Directive compilation
// $resource service being mocked
'use strict';
(function (angular) {
angular
.module('TestModule')
.service('DataService', DataService);
DataService.$inject = ['$resource'];
@rkunboxed
rkunboxed / gist:9115f550c00a6fc00737
Last active August 29, 2015 14:27 — forked from Mithrandir0x/gist:3639232
Difference between Service, Factory and Provider in AngularJS
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"