Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions controllers/hyper.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ var isCrossDomain = require('url').isCrossDomain;

pkg.controller('HyperController', [
'$scope',
'$rootScope',
'$routeParams',
'hyperBackend',
'hyperLinkFormatter',
function HyperController($scope, $routeParams, hyper, hyperLinkFormatter) {
function HyperController($scope, $rootScope, $routeParams, hyper, hyperLinkFormatter) {
// keep track of current the subscriptions
var subscriptions = {};

Expand Down Expand Up @@ -58,9 +59,10 @@ pkg.controller('HyperController', [
// subscribe to the href
subscriptions[key] = hyper
.get(href, function(err, body) {
// TODO handle error with angular
if (err) return console.error(err.stack || err);

if (err) {
$rootScope.$broadcast('hyperError', err, body);
return console.error(err.stack || err);
}
$safeApply.call($scope, function() {
$scope[key] = merge($scope[key], body);
});
Expand Down