Last active
August 29, 2015 14:23
-
-
Save brandonhesse/c2edf315aeedd5e53f88 to your computer and use it in GitHub Desktop.
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(ng, undefined) { | |
ng.module('sm.directive') | |
.factory('es6Macro', [function es6Macro() { | |
// ECMAScript6 style string replacement implemented in ES5 | |
return function macro(replace, macroString) { | |
var compiled = macroString, | |
keyR = Object.keys(replace), | |
replacementR = keyR.map(function (key) { | |
return new RegExp('\\${' + key + '}', 'g'); | |
}), keyIdx, replacementCnt = replacementR.length; | |
for (keyIdx = 0; keyIdx < replacementCnt; keyIdx += 1) { | |
compiled = compiled.replace(replacementR[keyIdx], replace[keyR[keyIdx]]); | |
} | |
return compiled; | |
}; | |
}]) | |
.directive('smCheckboxes', ['$templateCache', '$parse', function($tplCache, $parse) { | |
function postLink(scope, elm, attr, ctrls) { | |
} | |
return { | |
restrict: 'EA', | |
require: 'ngModel', | |
template: function (elem, attr) { | |
// Build the template via a macro method | |
return es6Macro( | |
{ | |
}, | |
$tplCache('template.html'); | |
); | |
}, | |
link: postLink | |
}; | |
}]); | |
})(angular); |
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
<label data-ng-repeat="${repeatClause}" class="control-label col-sm-12" data-ng-style="checkbox.style.label"> | |
<input name="${section}[]" class="form-control" data-ng-class="checkbox.style.input" | |
type="checkbox" data-ng-model="${model}" value="${name}"/><span | |
data-translate="${translate}"></span> | |
</label> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment