Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save elpddev/feb119c526f5a36c73cc655770e9754c to your computer and use it in GitHub Desktop.
Save elpddev/feb119c526f5a36c73cc655770e9754c to your computer and use it in GitHub Desktop.
AngularJs require component #angularjs #medium #article-hierarchical-di-ng
angular.component('printout', {
template: `<div>{{ $ctrl.model | json:2 }}</div>,
require: {
ngModel: '',
},
controller: ['$sce', '$element', function controller($sce, $element) {
this.$onInit = () {
this.ngModel.$render = function() {
$element.html($sce.getTrustedHtml(this.ngModel.$viewValue || ''));
};
};
}],
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment