panelApp.controller('OptionsCtrl', function OptionsCtrl($scope, appInfo, appHighlight) { $scope.debugger = { scopes: false, bindings: false, app: false }; ['scopes', 'bindings', 'app'].forEach(function (thing) { $scope.$watch('debugger.' + thing, function (val) { appHighlight[thing](val); }); }); appInfo.getAngularVersion(function (version) { $scope.$apply(function () { $scope.version = version; }); }); appInfo.getAngularSrc(function (status) { $scope.$apply(function () { switch(status) { case 'good': $scope.status = 'success'; $scope.explain = 'CDN detected'; break; case 'bad': $scope.status = 'important'; $scope.explain = 'You are using the old code.angularjs.org links, which are slow! You should switch to the new CDN link. See this post for more info'; break; case 'info': $scope.status = 'info'; $scope.explain = 'You may want to use the CDN-hosted AngularJS files. See this post for more info'; break; } }); }); });