angular.module("main.loadbalancer").controller("BindNodeCtrl", function($scope, $modalInstance, VipService, NodeService, Account, StatusTrackerService) {
(function(promise) {
return $scope.getNodeLabel = function(val) {
return promise.then(function(nodes) {
var dropDownItems;
dropDownItems = [];
_.forEach(nodes, function(node) {
if (_.str.include(node.id.toLowerCase(), val.toLowerCase())) {
return dropDownItems.push({
label: node.label,
address: node.address,
port: node.port_number,
value: node.id,
});
}
});
return _.sortBy(dropDownItems, 'label');
});
};
})(NodeService.getNodes()); <input type="text" id="label" name="label" ng-model="$parent.node.id" typeahead-min-length="1"
placeholder="Node Name / Label"
typeahead-editable="false"
typeahead="dropDownItem as dropDownItem.label for dropDownItem in getNodeLabel($viewValue)"
typeahead-template-url="typeahead/bind-node.html" style="width:100%;"
typeahead-loading="loadingNodeLabels" class="form-control" required>
<script type="text/ng-template" id="typeahead/bind-node.html">
<a><i>{{match.model.label}} — {{match.model.address}} — {{match.model.port}}</i></a>
</script>
typeahead-template-url.