|
@@ -170,7 +170,6 @@ function (_, $, coreModule) {
|
|
|
},
|
|
},
|
|
|
link: {
|
|
link: {
|
|
|
pre: function postLink($scope, elem, attrs) {
|
|
pre: function postLink($scope, elem, attrs) {
|
|
|
- var cachedOptions;
|
|
|
|
|
|
|
|
|
|
$scope.valueToSegment = function(value) {
|
|
$scope.valueToSegment = function(value) {
|
|
|
var option = _.find($scope.options, {value: value});
|
|
var option = _.find($scope.options, {value: value});
|
|
@@ -190,20 +189,13 @@ function (_, $, coreModule) {
|
|
|
});
|
|
});
|
|
|
return $q.when(optionSegments);
|
|
return $q.when(optionSegments);
|
|
|
} else {
|
|
} else {
|
|
|
- return $scope.getOptions().then(function(options) {
|
|
|
|
|
- cachedOptions = options;
|
|
|
|
|
- return _.map(options, function(option) {
|
|
|
|
|
- return uiSegmentSrv.newSegment({value: option.text});
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ return $scope.getOptions();
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
$scope.onSegmentChange = function() {
|
|
$scope.onSegmentChange = function() {
|
|
|
- var options = $scope.options || cachedOptions;
|
|
|
|
|
-
|
|
|
|
|
- if (options) {
|
|
|
|
|
- var option = _.find(options, {text: $scope.segment.value});
|
|
|
|
|
|
|
+ if ($scope.options) {
|
|
|
|
|
+ var option = _.find($scope.options, {text: $scope.segment.value});
|
|
|
if (option && option.value !== $scope.property) {
|
|
if (option && option.value !== $scope.property) {
|
|
|
$scope.property = option.value;
|
|
$scope.property = option.value;
|
|
|
} else if (attrs.custom !== 'false') {
|
|
} else if (attrs.custom !== 'false') {
|