【发布时间】:2014-10-21 16:56:19
【问题描述】:
对不起,英语是我的第二语言。
这是我的问题。我已将两个文本框绑定到范围。每个文本框都需要在更改时影响另一个。你会明白它会导致冲突。从现在开始,我明白了:
<input type="text" ng-model="celcius" ng-change="farenheit=celcius * 9/5 + 32 || ''">
<input type="text" ng-model="farenheit" ng-change="celcius=(farenheit - 32) * 5/9 || ''">
但它不能正常工作。知道如何欺骗吗?
【问题讨论】:
-
试试 type="number" 而不是 type="text"
-
你是个天才,它行得通!
标签: angularjs html-input angularjs-ng-change angularjs-ng-model