我试图在我的ngViews中设置第二个类型,即使我的代码几乎与第一个类似,第一个工作完美,而第二个通过' undefined'回调。
这里是非功能性预先标记的标记:
<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>
和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 = [];
}]);
我能发现的功能和非功能类型之间的唯一区别是变量名称和回调,但每次我 s 始终未定义在 nodeSearch 中点击我的断点。
我错过了什么?
答案 0 :(得分:1)
我想也许应该是viewValue而不是viewvalue。注意上限。 'V'