Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
一直在环顾四周,但我似乎找不到任何好的资源。有一个应用程序,一旦用户离开文本框/区域等,我想更新数据库中的数据,我想我可能可以使用 ngfocus 事件执行此操作,但我还需要获取哪个字段触发了更新。
不确定如何进行,可能不是使用 ngfocus 的最佳选择。如果可能的话,也许创建一个新指令或者扩展 ngfocus。任何建议表示赞赏。
请改用ngBlur。
HTML:
<input ng-blur='sendData()' />
只需确保您的控制器sendData在作用域上公开一个方法。
sendData