Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit edc586f

Browse files
committed
refactor(ngBindHtml): improve readability of the code
1 parent c739309 commit edc586f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/ng/directive/ngBind.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,20 +179,20 @@ var ngBindTemplateDirective = ['$interpolate', function($interpolate) {
179179
var ngBindHtmlDirective = ['$sce', '$parse', function($sce, $parse) {
180180
return {
181181
restrict: 'A',
182-
compile: function (tElement, tAttrs) {
182+
compile: function ngBindCompile(tElement, tAttrs) {
183183
tElement.addClass('ng-binding');
184184

185-
return function (scope, element, attr) {
185+
return function ngBindLink(scope, element, attr) {
186186
element.data('$binding', attr.ngBindHtml);
187-
var parsed = $parse(attr.ngBindHtml);
188-
var changeDetector = $parse(attr.ngBindHtml, function getStringValue(value) {
187+
var ngBindHtmlGetter = $parse(attr.ngBindHtml);
188+
var ngBindHtmlWatch = $parse(attr.ngBindHtml, function getStringValue(value) {
189189
return (value || '').toString();
190190
});
191191

192-
scope.$watch(changeDetector, function ngBindHtmlWatchAction() {
192+
scope.$watch(ngBindHtmlWatch, function ngBindHtmlWatchAction() {
193193
// we re-evaluate the expr because we want a TrustedValueHolderType
194194
// for $sce, not a string
195-
element.html($sce.getTrustedHtml(parsed(scope)) || '');
195+
element.html($sce.getTrustedHtml(ngBindHtmlGetter(scope)) || '');
196196
});
197197
};
198198
}

0 commit comments

Comments
 (0)