Sha256: 50599ad6a3844d9f057115fec173f153cefae8cb2508e6ecc8efaaac642376de
Contents?: true
Size: 1.27 KB
Versions: 12
Compression:
Stored size: 1.27 KB
Contents
app.provider('Examples', function() { var registry = {}; this.register = function(key, displayName, handler) { registry[key] = registry[key] || []; registry[key].unshift({ key: key, displayName: displayName, handler: handler }); }; this.removeHandlersForKey = function(key) { registry[key] = []; }; this.register('general', 'General', function() { return 'views/examples/general.html'; }); this.$get = function(prepareTemplate, $injector) { return { forContext: function(action, version, resource) { var results = {}; for (var key in registry) { for (var i = 0; i < registry[key].length; i++) { var result = $injector.invoke(registry[key][i].handler, this, { $action: action, $version: version, $context: { resource: resource, action: action, version: version } }); if (result) { results[key] = { key: key, displayName: registry[key][i].displayName, template: prepareTemplate(result) }; break; } } } return results; } }; }; });
Version data entries
12 entries across 12 versions & 1 rubygems