Created
December 19, 2015 18:26
-
-
Save geraldhumphries/ba159d2ea93c41d8054a to your computer and use it in GitHub Desktop.
JHipster autocomplete combobox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.loadOtherEntities = function(searchQuery) { | |
if (searchQuery){ | |
OtherEntitySearch.query({query: '*' + searchQuery + '*'}, function(result) { | |
$scope.otherEntities = result; | |
}, function(response) { | |
if(response.status === 404) { | |
$scope.otherEntities = OtherEntity.query({isActive: true}); | |
} | |
}); | |
} else { | |
$scope.otherEntities = OtherEntity.query({isActive: true}); | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="form-group"> | |
<label class="control-label" translate="jhApp.entity.otherEntity">otherEntity</label> | |
<ui-select reset-search-input="false" ng-model="entity.otherEntity"> | |
<ui-select-match allow-clear="true"> | |
<span ng-bind="$select.selected.name"></span> | |
</ui-select-match> | |
<ui-select-choices refresh="loadOtherEntities($select.search)" refresh-delay="200" | |
repeat="item in (otherEntities) track by item.id"> | |
<span ng-bind="item.name"></span> | |
</ui-select-choices> | |
</ui-select> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The requirement changed due to the complexity. Now they asked me to filter the pre populated results based on the query parameter that is selected on the top drop down.
Here is how it looks

The requirement is when the user selects the country 'US' I have to show only the states in 'US' in the States drop down. Please let me know if you have any sample projects in this scenario using Jhipster.
Thank you!