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
///<summary> | |
/// Provides methods for raising domaing events and registering their handlers. | |
///</summary> | |
public static class DomainEvents | |
{ | |
[ThreadStatic] | |
private static List<Delegate> actions; | |
/// <summary> | |
/// Gets or sets the service provider used to resolve event handlers. |
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
AppModule.directive('ngSubmit', function () { | |
var thiz = this; | |
thiz.submit = function (ev, scope, el, attr) { | |
el.removeClass('shake'); | |
var frmController = scope[attr.name]; | |
frmController.$attempted = true; // can be used to provide visual feedback | |
if (frmController.$invalid) { | |
el.find('.ng-invalid')[0].focus(); |
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
(function(angular) { | |
var alertsModule = angular.module('alerts', []); | |
alertsModule.service('$alerts', ['$rootScope', '$q', function($rootScope, $q){ | |
var _this = this; | |
var broadcast = function(topic, clazz, data){ | |
var d = $q.defer(); | |
$rootScope.$broadcast(topic, angular.extend({clazz: clazz, deferred: d}, data)); | |
return d.promise; | |
}; |
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
var server = require('./server.js'); | |
var collection = require('./collection.js'); | |
var app = server(); | |
app.put('/items/:id/part', server.resolve(collection), function(req, res){ | |
// no more 404 checking | |
// access resolved item |
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
MyModule.directive('tabindex', function () { | |
return { | |
restrict: 'A', | |
link: function (scope, elem, attr, ctrl) { | |
if (attr.tabindex == 1) { | |
elem.focus(); | |
} | |
} | |
}; | |
}); |