Skip to content

Instantly share code, notes, and snippets.

@simonmorley
Last active August 29, 2015 14:13
Show Gist options
  • Save simonmorley/3d802a7ad72fb410236e to your computer and use it in GitHub Desktop.
Save simonmorley/3d802a7ad72fb410236e to your computer and use it in GitHub Desktop.
'use strict';
var app = angular.module('ctLoginsApp.logins.directives', []);
app.directive('initialise', ['$routeParams', '$location', 'Login', function($routeParams, $location, Login) {
var link = function(scope,element,attrs) {
scope.loading = true;
var init = function(location_id, request_uri, apMac) {
Login.initialise({location_id: location_id, request_uri: request_uri, mac: apMac}).$promise.then(function(results) {
scope.loading = undefined;
}, function(err) {
displayError();
scope.loading = undefined;
});
var displayError = function() {
};
};
if ($routeParams.location_id) {
var location_id = $routeParams.location_id;
var request_uri = $location.host();
var mac = $routeParams.mac || $routeParams.sip;
init(location_id, request_uri, mac);
}
};
return {
link: link
};
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment