Skip to content

Instantly share code, notes, and snippets.

@elpddev
Last active August 29, 2020 08:13
Show Gist options
  • Save elpddev/5d57d06b3867ed46877ca61cd434d755 to your computer and use it in GitHub Desktop.
Save elpddev/5d57d06b3867ed46877ca61cd434d755 to your computer and use it in GitHub Desktop.
AngularJs require directive #angularjs #medium #article-hierarchical-di-ng
moviesApp.directive('printout', ['$sce', function printout($sce) {
return {
restrict: 'A',
require: {
ngModel: ''
},
link: (scope, element, attrs, requireCtrls) {
requireCtrls.ngModel.$render = function() {
element.html($sce.getTrustedHtml(requireCtrls.ngModel.$viewValue || ''));
};
}
};
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment