Skip to content

Instantly share code, notes, and snippets.

View pablotdl's full-sized avatar

Pablo S pablotdl

  • Tandil, Buenos Aires, Argentina
View GitHub Profile
hola Laurita, ves lo que estoy escribiendo?
si
@pablotdl
pablotdl / service.js
Last active August 29, 2015 14:22
Avoid using $q unless necessary. Most async methods already return a promise
/**
* This service showcases when to use $q to return promises and when it's not necessary'
*/
angular.module('sample').factory('sampleService', ['$q', '$http', function ($q, $http) {
var service = {};
// Use constants, don't do this
var url = 'https://api.github.com/users/pablotdl/repos';
/**
@pablotdl
pablotdl / usingRootScopeController.js
Created May 27, 2015 12:44
AngularJS service instead of $rootScope
'use strict'
/**
* A sample controller that stores data in the $rootScope
*/
angular.module('sample').controller('usingRootScopeController', ['$rootScope', '$scope', function ($rootScope, $scope) {
// Resets the list of items.
$scope.reset = function () {
$rootScope.someList = [];
}