Skip to content

Commit 2c21cdf

Browse files
committed
$parse only the promise, not the whole expression with filter filter
fixes the problem with angular 1.4 introduced by angular/angular.js#10352
1 parent 1804dba commit 2c21cdf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/helpers/parse-options.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ angular.module('mgcrea.ngStrap.helpers.parseOptions', [])
88
regexp: /^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+(.*?)(?:\s+track\s+by\s+(.*?))?$/
99
};
1010

11-
this.$get = function($parse, $q) {
11+
this.$get = function($parse, $q, $filter) {
1212

1313
function ParseOptionsFactory(attr, config) {
1414

@@ -28,12 +28,13 @@ angular.module('mgcrea.ngStrap.helpers.parseOptions', [])
2828
keyName = match[5],
2929
groupByFn = $parse(match[3] || ''),
3030
valueFn = $parse(match[2] ? match[1] : valueName),
31-
valuesFn = $parse(match[7]);
31+
valuesFn = $parse(match[7].split('|')[0]);
3232
};
3333

3434
$parseOptions.valuesFn = function(scope, controller) {
3535
return $q.when(valuesFn(scope, controller))
3636
.then(function(values) {
37+
values = $filter('filter')(values, controller.$viewValue);
3738
$parseOptions.$values = values ? parseValues(values, scope) : {};
3839
return $parseOptions.$values;
3940
});

0 commit comments

Comments
 (0)