I'm trying to set up a second typeahead in my ngViews, and even though my code is nearly identical to the first, the first works perfectly, while the second passes 'undefined' to the callback.
Here's the markup for non-functional typeahead:
<div id="toNodePicker" ng-if="!toNode.NodeId">
<label for="to-node-name">Pick a node:</label>
<input id="to-node-name" type="text" class="form-control" placeholder="Enter node"
typeahead-wait-ms=" 50"
typeahead-min-length="3"
ng-model="selectedToNode"
typeahead="toResult.Name for toResult in nodeSearch($viewvalue)" />
</div>
And the Javascript:
.controller('edgeAddCtrl', ['$scope', '$routeParams', 'graphService', 'resourceService',
function ($scope, $routeParams, graphService, resourceService) {
var fromType = null;
var toType = null;
$scope.selectedToNode = undefined;
$scope.toNode = {};
$scope.fromNodeSel = undefined;
$scope.fromNode = {};
if ($routeParams.nodeId) {
graphService.getNode($routeParams.nodeId)
.then(function(data) {
$scope.fromNode = data.data;
if ($scope.fromNode) {
fromType = $scope.fromNode.NodeTypeId;
}
if ($scope.toNode) {
toType = $scope.toNode.NodeTypeId;
}
graphService.getEdgeTypes(fromType, toType)
.then(function (data) {
$scope.edgeTypes = data.data;
$scope.selectedEdgeType = {};
});
});
}
$scope.nodeSearch = function(s) {
return graphService.getNodesForNewEdge(s, 'to', $scope.fromNode, $scope.toNode, $scope.selectedEdgeType.EdgeTypeId)
.then(function(data) {
return data.data;
});
}
$scope.edgeTypes = [];
}]);
The only differences left between the functional and the non-functional typeahead that I can spot are the variable names and the callback, yet s is consistently undefined every time I hit my breakpoint in nodeSearch.
What am I missing?