我如何赶上NG-模型绑定错误在AngularJS作为一个开发者? [英] How do I catch ng-model databinding errors in AngularJS as a developer?

查看:94
本文介绍了我如何赶上NG-模型绑定错误在AngularJS作为一个开发者?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想,我打错像

<input id="firstName" ng-model="vm.firstNameeeee"/>

或其中的纳克模型的正确绑定,但在服务器端的变化模型,现在纳克模型不正确的任何更多的情况。

or a case where the ng-model is bound correctly, but the model on the server-side changes and now the ng-model isn't correct any more.

目前的情况是,角会忽略这一点,不显示任何内容。

As it stands now, Angular just ignores this and does not display anything.

有关更多的数据密集型应用程序,你会preFER赶上这些东西并将其展示给开发商一定的能力,因此,这些错误是早期发现。

For more data-intensive applications, you would prefer some ability to catch these things and display them to the developer, so these bugs are caught early.

有没有办法在角NG-模型捕捉这样的数据绑定错误?你按照一定的实践抓住这个早?

Is there a way to catch such databinding errors in the Angular ng-model? Do you follow a certain practice to catch this early?

感谢您!

推荐答案

这我知道捕获这种错误的唯一方法是在测试时间。

The only way that I know of catching such errors is at the time of testing.

一块code的结束后,我(手动通过验证浏览器的功能)测试code,然后如果该功能不能正常工作,请找出它的原因。

After completion of a piece of code, I test the code (manually by verifying the functionality in the browser) and then if the functionality is not working, proceed to find the cause of it.

是的,AngularJS是沉默,甚至在控制台不会引发错误。因此,捕捉这些错误的最好办法是code以模块化的方式,功能,并在每个进站code小块,验证是否该功能可以运行。

Yes, AngularJS is silent and does not throw errors even in the console. So, the best way to catch these errors is to code in a modular fashion, code small chunks of functionality and at each pitstop, verify if the functionality works.

这篇关于我如何赶上NG-模型绑定错误在AngularJS作为一个开发者?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆