-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Conversation
Can you add some tests? |
I've followed the instructions posted by abudel, but it didn't work. |
Hi diogodomanski |
Thanks abudel. When will this feature be available in master branch? |
@abudel LGTM. As you might saw already, the source was split onto multiple files, can you rebase this PR so I can merge it? PD:Will be better if you just create a new branch from current master and apply all the changes, then just do a |
@dimirc thanks! i updated the repo as you asked. |
@abudel it's hard to test your changes as But thank you very much for your work! 👍 This PR will definitely fix my #619 issue after merging and publishing in bower. |
@abudel I still see changes to /dist files. Pls keep in mind that we should only change /src files. Also could you try to squash it all into one commit? Let me know if you have any trouble on this changes. |
@abudel In your fork's master branch (and it's specified as this PR branch) there is currently not only commit 33f4d9f but also another commits after it with various merges and so on. See your fork's Network page for a visual representation. If you do not need these extra commits in your fork's
After that contents of this PR will be updated. Please note that other commits from your master branch will disappear. If you do need these commits, please create a new branch from commit 33f4d9f and create a new PR from it (I see that there is a This article from GitHub Help may help you: Using pull requests |
Can anyone fix these merge conflits and make this feature available in master branch? Thanks |
Hey guys will this feature be available in the master brach, it is very useful? |
+1 Really Usefull. add this one to master. Thank you |
It's a must-have feature, could you please integrate it? |
+1 |
Hi. Seems that this can be achieved by custom directive like the following: myModule.directive('uiSelectLazyLoad', function ($parse) {
return {
restrict: 'A',
scope: true, // create new but not isolated scope
compile: function (element, attrs) {
var $choices = element.find('ui-select-choices'),
refreshAttr = $choices.attr('refresh'),
refreshFunc = null;
if(!refreshAttr) {
return;
}
refreshFunc = $parse(refreshAttr, /* interceptorFn */ null, /* expensiveChecks */ true);
// replace all 'refresh' contents by own function
$choices.attr('refresh', 'ptUiSelectLazyLoadHandler($event)');
return function linkFn(scope, element, attrs) {
var activated = false;
element.one('click', function () {
activated = true;
scope.ptUiSelectLazyLoadHandler();
});
scope.ptUiSelectLazyLoadHandler = function ($event) {
if(!activated) {
return;
}
refreshFunc(scope);
};
};
}
};
}); The directive can be used like this: <ui-select ng-model="dummy" ui-select-lazy-load>
<ui-select-match>{{$select.selected.name}}</ui-select-match>
<ui-select-choices
repeat="soft.id as soft in softs"
refresh="loadSoft($select.search)"
refresh-delay="200">
<div ng-bind-html="soft.name | highlight: $select.search"></div>
</ui-select-choices>
</ui-select> Function specified in "refresh" attribute on |
+1, must have feature! |
+1 |
4 similar comments
+1 |
+1 |
+1 |
+1 |
+1 |
1 similar comment
+1 |
+1 |
Will this feature be in the dist? It's a must-have! |
+1 |
3 similar comments
+1 |
+1 |
+1 |
when is this going to be pulled into master? |
+1 |
1 similar comment
+1 |
Why is this not pulled yet? Its an awesome feature... +1 |
@twizzzlers:
Note you could probably achieve this with custom directive such as: app.directive('refreshOnActivate', function() {
return {
require: 'uiSelect',
link: function(scope, element, attrs, $select) {
var _activate = $select.activate;
$select.activate = function (initSearchValue, avoidReset) {
_activate(initSearchValue, avoidReset);
$select.refresh();
}
}
};
}); |
Any update on this feature? |
@shyamal890 My reply is literally just before yours! 😅 |
@user378230 Thats right, but I was wondering when the solution would be added to master? |
It can't be, as I said in my reply: This branch has conflicts that must be resolved @shyamal890 also did you try using separate directive as I mentioned? |
+1 |
This works for me: <ui-select-choices refresh="myCustomRefresh($select.search)" refresh-on-active="true"></ui-select-choices> app.directive('refreshOnActive', refreshOnActive);
function refreshOnActive() {
return {
restrict: 'A',
link: refreshOnActiveLink,
scope: {
refreshOnActive: '=',
refresh: '@'
}
}
function refreshOnActiveLink(scope, element) {
if (! scope.refreshOnActive === true) {
return;
}
var storedFunction = scope.$parent.$select.refresh;
scope.$parent.$select.refresh = function() {};
var element = angular.element(element).closest('.ui-select-container');
var fn = function() {
scope.$parent.$select.refresh = function() {
storedFunction(scope.refresh);
};
scope.$parent.$select.refresh.call();
element.unbind('click', fn);
};
element.bind('click', fn);
}
} |
As the PR #1845 is merged please verify if it fix your problem. |
Closing it down due to comment above (believe this should fix it), if needed you can reopen it. |
From #271,
By setting to true the attribute "refresh-on-active" in the "ui-select-choiche", refresh method is called when the component is activated the first time.