This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
myApp.directive('widgetErrorMask', function() { | |
return { | |
restrict: 'E', | |
replace: 'true', | |
transclude: true, | |
template: '<div class="error-mask" ng-show="errorMaskVisible"><div>{{errorMessage}}</div></div>' | |
}; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="widget" ng-controller="WidgetControl"> | |
<h2>My Widget</h2> | |
<!-- ... --> | |
<widget-error-mask></widget-error-mask> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
myApp.controller('MyWidgetControl', function($scope, $controller) { | |
$controller('AbstractWidgetControl', {$scope: $scope}); | |
//"Public" functions | |
$scope.myFunction = function() { | |
//... | |
}; | |
//Private functions | |
function myPrivateFn() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
myApp.controller('AbstractWidgetControl', function($scope) { | |
$scope.errorMaskVisible = false; | |
$scope.errorMessage = ''; | |
$scope.showErrorMask = function(message) { | |
$scope.errorMessage = message || 'Unknown error occurred'; | |
$scope.errorMaskVisible = true; | |
}; | |
$scope.hideErrorMask = function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("MyService", function() { | |
'use strict'; | |
var service; | |
beforeEach(module('myApp')); | |
beforeEach(inject(function($templateCache) { | |
//Whatever the default route is, needs to be cached so $httpBackend doesn't see other requests | |
$templateCache.put('views/default.html', __html__['src/main/webapp/views/default.html']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
myApp.factory('MyService', function($http, $q) { | |
//Local vars | |
var state = {}; | |
//Publicly exposed functions | |
var me = function() {}; | |
me.prototype = { | |
getState: function(key) { | |
return state[key]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
*/ | |
Ext.define('Oxford.view.base.OverviewSection', { | |
extend: 'Ext.Component', | |
/** | |
* @cfg {String} sectionName | |
*/ | |
sectionName: 'Section', |