Skip to content

Instantly share code, notes, and snippets.

@glosik
Created July 6, 2017 21:15
Show Gist options
  • Save glosik/26eaf57ed459274401792d087e961873 to your computer and use it in GitHub Desktop.
Save glosik/26eaf57ed459274401792d087e961873 to your computer and use it in GitHub Desktop.
ng-content
app.directive('ngBindAttrs', function() {
return function(scope, element, attrs) {
scope.$watch(attrs.ngBindAttrs, function(value) {
angular.forEach(value, function(value, key) {
attrs.$set(key, value);
})
}, true)
}
});
<input type="text" ng-bind-attrs="{placeholder: somePropertyOfTheScope, tabindex: anotherPropertyOfTheScope}" >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment