A Pen by Daniele Moraschi on CodePen.
see: pen
A Pen by Daniele Moraschi on CodePen.
see: pen
'use strict'; | |
/** | |
* A directive to handle local storage | |
*/ | |
tool.directive('storage', ['$log', '$modal', 'storageSVC', 'locationSVC', function($log, $modal, storageSVC, locationSVC) { | |
return { | |
restrict: 'EA', |
{ | |
"requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch", "case", "default"], | |
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"], | |
"requireParenthesesAroundIIFE": true, | |
"requireSpacesInFunctionExpression": { "beforeOpeningCurlyBrace": true }, | |
"disallowSpacesInFunctionExpression": { "beforeOpeningRoundBrace": true }, | |
"requireMultipleVarDecl": true, | |
"disallowEmptyBlocks": true, | |
"disallowSpacesInsideObjectBrackets": true, | |
"disallowSpacesInsideArrayBrackets": true, |
{ | |
"globalstrict": true, | |
"globals": { | |
"this" : false, | |
"localStorage": false, | |
"angular": true, | |
"Firebase": true, | |
"Modernizr": true, | |
"moment" : true, | |
"tool" : true, |
// see: http://stackoverflow.com/questions/1354064/how-to-convert-characters-to-html-entities-using-plain-javascript | |
// TODO move to $filters | |
var escapeHtmlEntities = function(text) { | |
return text.replace(/[\u00A0-\u2666<>\&]/g, function(c) { | |
return '&' + | |
(escapeHtmlEntities.entityTable[c.charCodeAt(0)] || '#' + c.charCodeAt(0)) + ';'; | |
}); | |
}; | |
// the wrong kind of entities for our purpose but worth keeping |
<template name="ngsd" value="(function () { 'use strict'; /** * * @author $name$ * @date $date$ * * @name * $module$:$directiveName$ * * @param {data} $input1$ An input two-way binding * @param {function} $function1$ An output function * * @description $description$ * Trying to follow the style guidelines from: {https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#angular-docs Angular 1 Style Guide <br> * @example <pre> <$nameDash$ $inputDash1$='data' $functionDash1$='update'> <$nameDash$/> <pre> * */ try { module = angular.module('$module$'); } catch (err) { module = angular.module('$module$', []) } module.directive('$directiveName$', $directiveNa |
<template name="ngf" value="(function () { 'use strict'; /** * * @author $name$ * @date $date$ * * @name * $module$:$factoryName$ * * @param {obj} $value1$ An accessible member * @param {function} $function1$ A function the Factory returns * @param {function} $function2$ A function the Factory returns * * // define module requirements * @requires $dependancy1$ * @requires $dependancy2$ * * // define `imports` * @requires $import1$ * @requires $import2$ * * @description $description$ * Trying to follow the style guidelines from: {https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#angular-docs Angular 1 Style Guide <br> * */ // Ideally each Directive will have a unique package, so this try, catch won`t be required <br> |