Skip to content

Instantly share code, notes, and snippets.

@vivainio
Created December 29, 2017 13:52
Show Gist options
  • Select an option

  • Save vivainio/69741abc13d03481ccd9477b1b94a7e4 to your computer and use it in GitHub Desktop.

Select an option

Save vivainio/69741abc13d03481ccd9477b1b94a7e4 to your computer and use it in GitHub Desktop.
angular.module('app').directive('props', function() {
return {
link: function(scope, element, attrs) {
scope.$watchCollection(attrs.props, function(newValues) {
for (const key in newValues) {
if (newValues.hasOwnProperty(key)) {
element[0][key] = newValues[key];
}
}
});
}
};
});
export {};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment