[appSwitcher] check for chrome on $scope

This commit is contained in:
spalger 2015-09-22 15:33:45 -07:00
parent 16165d6c5b
commit 344aed432d

View file

@ -1,4 +1,5 @@
var parse = require('url').parse;
var bindKey = require('lodash').bindKey;
require('../appSwitcher/appSwitcher.less');
@ -9,7 +10,15 @@ require('ui/modules')
restrict: 'E',
template: require('./appSwitcher.html'),
controllerAs: 'switcher',
controller: function () {
controller: function ($scope, $window) {
// since we render this in an isolate scope we can't "require: ^chrome", but
// rather than remove all helpfull checks we can just check here.
if (!$scope.chrome || !$scope.chrome.getNavLinks) {
throw new TypeError('appSwitcher directive requires the "chrome" config-object');
}
this.getNavLinks = bindKey($scope.chrome, 'getNavLinks');
// links don't cause full-navigation events in certain scenarios
// so we force them when needed