Javascript 禁用按钮,同时使用角度选择另一个按钮

Javascript 禁用按钮,同时使用角度选择另一个按钮,javascript,angularjs,Javascript,Angularjs,我有3个角度函数,可以切换搜索功能。但是,我只希望能够一次选择一个 /*创伤搜索功能*/ $scope.traumaSearch=false; $scope.traumaText=“创伤中心”; $scope.toggleTraumaSearch=函数(){ $scope.traumaSearch=!$scope.traumaSearch; 如果($scope.traumaSearch){ $scope.traumaText=“选择一个位置…”; canvas.style.cursor='cr

我有3个角度函数,可以切换搜索功能。但是,我只希望能够一次选择一个

/*创伤搜索功能*/
$scope.traumaSearch=false;
$scope.traumaText=“创伤中心”;
$scope.toggleTraumaSearch=函数(){
$scope.traumaSearch=!$scope.traumaSearch;
如果($scope.traumaSearch){
$scope.traumaText=“选择一个位置…”;
canvas.style.cursor='crosshair';
}否则{
$scope.traumaText=“创伤中心”;
canvas.style.cursor='';
}
}
/*警方搜索功能*/
$scope.policysearch=false;
$scope.policeText=“警察局”;
$scope.togglepolicysearch=函数(){
$scope.policysearch=!$scope.policysearch;
if($scope.policysearch){
$scope.policText=“选择一个位置…”;
canvas.style.cursor='crosshair';
}否则{
$scope.policeText=“警察局”;
canvas.style.cursor='';
}
}
/*火力搜索功能*/
$scope.fireSearch=false;
$scope.fireText=“消防局”;
$scope.toggleFireSearch=函数(){
$scope.fireSearch=!$scope.fireSearch;
if($scope.fireSearch){
$scope.fireText=“选择一个位置…”;
canvas.style.cursor='crosshair';
}否则{
$scope.fireText=“消防局”;
canvas.style.cursor='';
}
}

找到最近的急救服务
{{traumaText}}
{{policytext}}
{{fireText}}

您可以使用元素标记
ng if=“VARNAME”
检查范围内的变量是否为真。为每个搜索元素(或数组)使用不同的var。然后,您可以切换whateversearch()将该变量设置为true,并将所有其他变量设置为false