【发布时间】:2015-02-18 12:19:26
【问题描述】:
当用户在设置菜单中选中复选框时,我想禁用预先输入功能 (id = searchSuggestions)。下面的代码仅在页面重新加载时有效,但在会话期间无效。是否可以在会话期间禁用 Angular 的预输入实现?如果有,怎么做?
// Controller for Angular's Search implementation
app.controller('TypeaheadCtrl', function($scope, $http) {
$scope.selected = undefined;
// prefetch the results
var value = $('#searchSuggestions').is(':checked');
if (value == true) {
$.getJSON('/typeahead', function(response){
//parse your response and assign it
$scope.recentPopularQueries = response;
});
// Fire off the transcribe(words) function as soon as a choice is selected
$scope.onSelect = function ($item, $model, $label) {
$scope.$label = $label;
transcribe($scope.$label);
};
}
});
【问题讨论】:
标签: angularjs angular-ui-typeahead