mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-17 12:15:56 +08:00
perf(ngBind): bypass jquery/jqlite when setting text
This commit is contained in:
@@ -57,11 +57,13 @@ var ngBindDirective = ngDirective({
|
||||
|
||||
return function ngBindLink(scope, element, attr) {
|
||||
element.data('$binding', attr.ngBind);
|
||||
element = element[0];
|
||||
|
||||
scope.$watch(attr.ngBind, function ngBindWatchAction(value) {
|
||||
// We are purposefully using == here rather than === because we want to
|
||||
// catch when value is "null or undefined"
|
||||
// jshint -W041
|
||||
element.text(value == undefined ? '' : value);
|
||||
element.textContent = (value == undefined ? '' : value);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user