Skip to content

Instantly share code, notes, and snippets.

View jakemmarsh's full-sized avatar

Jake Marsh jakemmarsh

View GitHub Profile
@jakemmarsh
jakemmarsh / directives.js
Created June 26, 2013 14:18
AngularJS directive to create a functional "back" button
app.directive('backButton', function(){
return {
restrict: 'A',
link: function(scope, element, attrs) {
element.bind('click', goBack);
function goBack() {
history.back();
scope.$apply();
@jakemmarsh
jakemmarsh / controllers.js
Last active May 20, 2019 10:15
AngularJS Service with Controller for access to Google API with Javascript Client (and RequireJS)
define(['angular', 'services'], function (angular) {
'use strict';
return angular.module('myApp.controllers', ['myApp.services'])
.controller('IndexCtrl', ['$scope', 'googleService', function ($scope, googleService) {
$scope.login = function () {
googleService.login().then(function (data) {
// do something with returned data
console.log(data.email);