Created
August 29, 2020 08:12
-
-
Save elpddev/feb119c526f5a36c73cc655770e9754c to your computer and use it in GitHub Desktop.
AngularJs require component #angularjs #medium #article-hierarchical-di-ng
This file contains hidden or 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
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