Skip to content

Commit 8484123

Browse files
committed
Merge pull request #187 from ammendonca/PTNFLY-1122
PTNFLY-1122 : Fix pfSelect options and ng-model watches
2 parents 0f794c4 + 6d1147b commit 8484123

32 files changed

+114
-57
lines changed

dist/angular-patternfly.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3593,27 +3593,31 @@ angular.module('patternfly.select', []).directive('pfSelect', ["$timeout", funct
35933593
link: function (scope, element, attrs, ngModel) {
35943594
var optionCollectionList, optionCollection, $render = ngModel.$render;
35953595

3596+
var selectpickerRefresh = function (argument) {
3597+
scope.$applyAsync(function () {
3598+
element.selectpicker('refresh');
3599+
});
3600+
};
3601+
35963602
element.selectpicker(scope.selectPickerOptions);
35973603

35983604
ngModel.$render = function () {
35993605
$render.apply(this, arguments);
3600-
$timeout(function () {
3601-
element.selectpicker('refresh');
3602-
}, 0, false);
3606+
selectpickerRefresh();
36033607
};
36043608

36053609
if (attrs.ngOptions) {
36063610
optionCollectionList = attrs.ngOptions.split('in ');
36073611
optionCollection = optionCollectionList[optionCollectionList.length - 1];
36083612

3609-
scope.$watchCollection(optionCollection, function () {
3610-
element.selectpicker('refresh');
3611-
});
3613+
scope.$parent.$watchCollection(optionCollection, selectpickerRefresh);
36123614
}
36133615

3614-
attrs.$observe('disabled', function () {
3615-
element.selectpicker('refresh');
3616-
});
3616+
if (attrs.ngModel) {
3617+
scope.$parent.$watch(attrs.ngModel, selectpickerRefresh);
3618+
}
3619+
3620+
attrs.$observe('disabled', selectpickerRefresh);
36173621
}
36183622
};
36193623
}]);

dist/angular-patternfly.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/docs/grunt-scripts/angular-patternfly.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3593,27 +3593,31 @@ angular.module('patternfly.select', []).directive('pfSelect', ["$timeout", funct
35933593
link: function (scope, element, attrs, ngModel) {
35943594
var optionCollectionList, optionCollection, $render = ngModel.$render;
35953595

3596+
var selectpickerRefresh = function (argument) {
3597+
scope.$applyAsync(function () {
3598+
element.selectpicker('refresh');
3599+
});
3600+
};
3601+
35963602
element.selectpicker(scope.selectPickerOptions);
35973603

35983604
ngModel.$render = function () {
35993605
$render.apply(this, arguments);
3600-
$timeout(function () {
3601-
element.selectpicker('refresh');
3602-
}, 0, false);
3606+
selectpickerRefresh();
36033607
};
36043608

36053609
if (attrs.ngOptions) {
36063610
optionCollectionList = attrs.ngOptions.split('in ');
36073611
optionCollection = optionCollectionList[optionCollectionList.length - 1];
36083612

3609-
scope.$watchCollection(optionCollection, function () {
3610-
element.selectpicker('refresh');
3611-
});
3613+
scope.$parent.$watchCollection(optionCollection, selectpickerRefresh);
36123614
}
36133615

3614-
attrs.$observe('disabled', function () {
3615-
element.selectpicker('refresh');
3616-
});
3616+
if (attrs.ngModel) {
3617+
scope.$parent.$watch(attrs.ngModel, selectpickerRefresh);
3618+
}
3619+
3620+
attrs.$observe('disabled', selectpickerRefresh);
36173621
}
36183622
};
36193623
}]);

dist/docs/partials/api/patternfly.autofocus.pfFocused.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<a href="https://github.com/patternfly/angular-patternfly/edit/master/src/autofocus/autofocus.js" class="improve-docs"><i class="icon-edit"> </i>Improve this doc</a><a href="https://github.com/patternfly/angular-patternfly/blob/753c6c0/src/autofocus/autofocus.js#L39" class="view-source"><i class="icon-eye-open"> </i>View source</a><h1><code ng:non-bindable="">pfFocused</code>
1+
<a href="https://github.com/patternfly/angular-patternfly/edit/master/src/autofocus/autofocus.js" class="improve-docs"><i class="icon-edit"> </i>Improve this doc</a><a href="https://github.com/patternfly/angular-patternfly/blob/7271e2f/src/autofocus/autofocus.js#L39" class="view-source"><i class="icon-eye-open"> </i>View source</a><h1><code ng:non-bindable="">pfFocused</code>
22
<div><span class="hint">directive in module <code ng:non-bindable="">patternfly</code>
33
</span>
44
</div>

dist/docs/partials/api/patternfly.card.directive.pfAggregateStatusCard.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<a href="https://github.com/patternfly/angular-patternfly/edit/master/src/card/aggregate-status/aggregate-status-card.directive.js" class="improve-docs"><i class="icon-edit"> </i>Improve this doc</a><a href="https://github.com/patternfly/angular-patternfly/blob/753c6c0/src/card/aggregate-status/aggregate-status-card.directive.js#L129" class="view-source"><i class="icon-eye-open"> </i>View source</a><h1><code ng:non-bindable="">pfAggregateStatusCard</code>
1+
<a href="https://github.com/patternfly/angular-patternfly/edit/master/src/card/aggregate-status/aggregate-status-card.directive.js" class="improve-docs"><i class="icon-edit"> </i>Improve this doc</a><a href="https://github.com/patternfly/angular-patternfly/blob/7271e2f/src/card/aggregate-status/aggregate-status-card.directive.js#L129" class="view-source"><i class="icon-eye-open"> </i>View source</a><h1><code ng:non-bindable="">pfAggregateStatusCard</code>
22
<div><span class="hint">directive in module <code ng:non-bindable="">patternfly.card</code>
33
</span>
44
</div>

dist/docs/partials/api/patternfly.card.directive.pfCard.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<a href="https://github.com/patternfly/angular-patternfly/edit/master/src/card/basic/card.directive.js" class="improve-docs"><i class="icon-edit"> </i>Improve this doc</a><a href="https://github.com/patternfly/angular-patternfly/blob/753c6c0/src/card/basic/card.directive.js#L210" class="view-source"><i class="icon-eye-open"> </i>View source</a><h1><code ng:non-bindable="">pfCard</code>
1+
<a href="https://github.com/patternfly/angular-patternfly/edit/master/src/card/basic/card.directive.js" class="improve-docs"><i class="icon-edit"> </i>Improve this doc</a><a href="https://github.com/patternfly/angular-patternfly/blob/7271e2f/src/card/basic/card.directive.js#L210" class="view-source"><i class="icon-eye-open"> </i>View source</a><h1><code ng:non-bindable="">pfCard</code>
22
<div><span class="hint">directive in module <code ng:non-bindable="">patternfly.card</code>
33
</span>
44
</div>

dist/docs/partials/api/patternfly.charts.directive.pfC3Chart.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<a href="https://github.com/patternfly/angular-patternfly/edit/master/src/charts/c3/c3-chart.directive.js" class="improve-docs"><i class="icon-edit"> </i>Improve this doc</a><a href="https://github.com/patternfly/angular-patternfly/blob/753c6c0/src/charts/c3/c3-chart.directive.js#L65" class="view-source"><i class="icon-eye-open"> </i>View source</a><h1><code ng:non-bindable="">pfC3Chart</code>
1+
<a href="https://github.com/patternfly/angular-patternfly/edit/master/src/charts/c3/c3-chart.directive.js" class="improve-docs"><i class="icon-edit"> </i>Improve this doc</a><a href="https://github.com/patternfly/angular-patternfly/blob/7271e2f/src/charts/c3/c3-chart.directive.js#L65" class="view-source"><i class="icon-eye-open"> </i>View source</a><h1><code ng:non-bindable="">pfC3Chart</code>
22
<div><span class="hint">directive in module <code ng:non-bindable="">patternfly.charts</code>
33
</span>
44
</div>

dist/docs/partials/api/patternfly.charts.directive.pfDonutPctChart.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<a href="https://github.com/patternfly/angular-patternfly/edit/master/src/charts/donut/donut-pct-chart-directive.js" class="improve-docs"><i class="icon-edit"> </i>Improve this doc</a><a href="https://github.com/patternfly/angular-patternfly/blob/753c6c0/src/charts/donut/donut-pct-chart-directive.js#L233" class="view-source"><i class="icon-eye-open"> </i>View source</a><h1><code ng:non-bindable="">pfDonutPctChart</code>
1+
<a href="https://github.com/patternfly/angular-patternfly/edit/master/src/charts/donut/donut-pct-chart-directive.js" class="improve-docs"><i class="icon-edit"> </i>Improve this doc</a><a href="https://github.com/patternfly/angular-patternfly/blob/7271e2f/src/charts/donut/donut-pct-chart-directive.js#L233" class="view-source"><i class="icon-eye-open"> </i>View source</a><h1><code ng:non-bindable="">pfDonutPctChart</code>
22
<div><span class="hint">directive in module <code ng:non-bindable="">patternfly.charts</code>
33
</span>
44
</div>

dist/docs/partials/api/patternfly.charts.directive.pfHeatMap.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<a href="https://github.com/patternfly/angular-patternfly/edit/master/src/charts/heatmap/heatmap.directive.js" class="improve-docs"><i class="icon-edit"> </i>Improve this doc</a><a href="https://github.com/patternfly/angular-patternfly/blob/753c6c0/src/charts/heatmap/heatmap.directive.js#L135" class="view-source"><i class="icon-eye-open"> </i>View source</a><h1><code ng:non-bindable="">pfHeatMap</code>
1+
<a href="https://github.com/patternfly/angular-patternfly/edit/master/src/charts/heatmap/heatmap.directive.js" class="improve-docs"><i class="icon-edit"> </i>Improve this doc</a><a href="https://github.com/patternfly/angular-patternfly/blob/7271e2f/src/charts/heatmap/heatmap.directive.js#L135" class="view-source"><i class="icon-eye-open"> </i>View source</a><h1><code ng:non-bindable="">pfHeatMap</code>
22
<div><span class="hint">directive in module <code ng:non-bindable="">patternfly.charts</code>
33
</span>
44
</div>

dist/docs/partials/api/patternfly.charts.directive.pfSparklineChart.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<a href="https://github.com/patternfly/angular-patternfly/edit/master/src/charts/sparkline/sparkline-chart.directive.js" class="improve-docs"><i class="icon-edit"> </i>Improve this doc</a><a href="https://github.com/patternfly/angular-patternfly/blob/753c6c0/src/charts/sparkline/sparkline-chart.directive.js#L133" class="view-source"><i class="icon-eye-open"> </i>View source</a><h1><code ng:non-bindable="">pfSparklineChart</code>
1+
<a href="https://github.com/patternfly/angular-patternfly/edit/master/src/charts/sparkline/sparkline-chart.directive.js" class="improve-docs"><i class="icon-edit"> </i>Improve this doc</a><a href="https://github.com/patternfly/angular-patternfly/blob/7271e2f/src/charts/sparkline/sparkline-chart.directive.js#L133" class="view-source"><i class="icon-eye-open"> </i>View source</a><h1><code ng:non-bindable="">pfSparklineChart</code>
22
<div><span class="hint">directive in module <code ng:non-bindable="">patternfly.charts</code>
33
</span>
44
</div>

0 commit comments

Comments
 (0)