Skip to content

Instantly share code, notes, and snippets.

@jeamland
Created January 31, 2014 09:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeamland/8728932 to your computer and use it in GitHub Desktop.
Save jeamland/8728932 to your computer and use it in GitHub Desktop.
"use strict";
var diffViewerApp = angular.module('diffViewerApp', ['ngRoute']);
diffViewerApp.config(function ($routeProvider, $locationProvider) {
$routeProvider.when('/', {
templateUrl: 'dir.html',
controller: 'DiffViewerCtrl'
});
$routeProvider.when('/:dirPath/', {
templateUrl: 'dir.html',
controller: 'DiffViewerCtrl'
});
$locationProvider.html5mode(true);
});
diffViewerApp.controller('DiffViewerCtrl', function ($scope, $http, $window) {
console.log($window.location.pathname);
$http.get('/data' + $window.location.pathname).
success(function (data, status, headers, config) {
$scope.entries = data.entries;
console.log(data);
})
.error(function (data, status, headers, config) {
alert("Unable to load data.");
console.error(status);
});
$scope.entries = [];
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment