Skip to content

Instantly share code, notes, and snippets.

Avatar

Jake Marsh jakemmarsh

View GitHub Profile
@jakemmarsh
jakemmarsh / directives.js
Created Jun 26, 2013
AngularJS directive to create a functional "back" button
View directives.js
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
AngularJS Service with Controller for access to Google API with Javascript Client (and RequireJS)
View controllers.js
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);