Javascript 禁用ng自动完成(或通常禁用div属性)
我有两个按钮,可选择我想要解决的两种不同情况。当我选择按钮#2时,我想禁用输入栏上的自动完成功能(使用ng autocomplete启用),但我一生都不知道如何轻松地做到这一点(不完全插入新的div,这听起来是个坏主意) 我尝试过为不同的东西设置值,但没有效果。有没有办法动态禁用此功能 有关守则:Javascript 禁用ng自动完成(或通常禁用div属性),javascript,html,angularjs,autocomplete,Javascript,Html,Angularjs,Autocomplete,我有两个按钮,可选择我想要解决的两种不同情况。当我选择按钮#2时,我想禁用输入栏上的自动完成功能(使用ng autocomplete启用),但我一生都不知道如何轻松地做到这一点(不完全插入新的div,这听起来是个坏主意) 我尝试过为不同的东西设置值,但没有效果。有没有办法动态禁用此功能 有关守则: <input id="businessID" type="text" ng-autocomplete ng-model="autocomplete" placeholder="What busi
<input id="businessID" type="text" ng-autocomplete ng-model="autocomplete" placeholder="What business do you want to pay?">
我刚想到一个想法,它认为它可以回答你的问题:
<input id="businessID" type="text" ng-autocomplete ng-model="autocomplete" placeholder="What business do you want to pay?">
创建两个输入:
- 一个是自动完成的
<input ng-if="!disabled" id="businessID" type="text" ng-autocomplete ng-model="autocomplete" placeholder="What business do you want to pay?">
- 第二无
<input ng-if="disabled" id="businessID" type="text" ng-model="autocomplete" placeholder="What business do you want to pay?">
<button ng-click="disabled = !disabled">Disable autocomeplete</button>
禁用自动完成
这需要进行一些调整,才能使其顺利运行,但这绝对为我指明了正确的方向。非常感谢。(我会在时间一到就给你奖金)很高兴听到这帮了你