Я хотел бы отключить функцию ввода текста, когда у пользователя установлен флажок в меню настроек (id = searchSuggestions). Приведенный ниже код работает только при новой перезагрузке страницы, но не во время сеанса. Можно ли отключить реализацию углового ввода во время сеанса? Если да, то как?
// 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);
};
}
});