From 1582d54ecaf81cb516a28368c0d409b5d5fe7da9 Mon Sep 17 00:00:00 2001 From: Dean Sofer Date: Fri, 18 Oct 2013 13:36:21 -0700 Subject: [PATCH] feat(alias): Created a new ui-alias module for renaming/combining directives --- modules/alias/README.md | 42 +++++++++++++++++++++++++++++++++++++++++ modules/alias/alias.js | 14 ++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 modules/alias/README.md create mode 100644 modules/alias/alias.js diff --git a/modules/alias/README.md b/modules/alias/README.md new file mode 100644 index 00000000..5c72a791 --- /dev/null +++ b/modules/alias/README.md @@ -0,0 +1,42 @@ +ui-alias +-------- + +Rename third-party directives or quickly generate simple template directives for use internally in your app! + +* Sick of the `ui-*` `bs-*` and other such prefixes cluttering up your beautiful html? +* Always find you're calling the same set of directives together? + +Now you can **ALIAS** it! + +## Installation + +1. Load `alias.js` +2. Add `ui.alias` as a dependency +3. Create a `uiAliasConfig` constant on the `ui.alias` module + +## Configuration + +* Create a `constant` on the `ui.alias` module +* Keys are your alias, while the values are either a string template or a [DirectiveDefinitionObject](http://docs.angularjs.org/guide/directive#writingdirectiveslongversion) +* Aliases create new directives that generate templates +* Alias directives are `replace: true` by default unless explicitly set to `false` + +```js +angular.module('ui.alias').constant('uiAliasConfig', { + 'alias': '', + 'alias2': { + template: '', + restrict: 'AEC' + } + // Example: + date: '' + +}); +``` + +## Notes + +* Be careful to avoid creating an alias that fires recursively + Example: `