Skip to content
This repository has been archived by the owner on May 21, 2021. It is now read-only.

Commit

Permalink
perf(ng-model): extract parsing ng-model expression from update funct…
Browse files Browse the repository at this point in the history
…ion to do it once
  • Loading branch information
Philipp Burgmer committed Jul 21, 2014
1 parent c8309d4 commit c5ef7df
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/w11k-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,14 +552,16 @@ angular.module('w11k.select').directive('w11kSelect', [
updateHeader();
}

var ngModelSetter = $parse(attrs.ngModel).assign;

function updateNgModel() {
var value = options2model(options);

angular.forEach(controller.$parsers, function (fn) {
value = fn(value);
angular.forEach(controller.$parsers, function (parser) {
value = parser(value);
});

$parse(attrs.ngModel).assign(scope.$parent, value);
ngModelSetter(scope.$parent, value);
}

var ngModelRead;
Expand Down

0 comments on commit c5ef7df

Please sign in to comment.