最近在学习angularjs,但是angularjs报错很痛苦,报错的时候不知道是哪个组件出的错。
有没有办法能定位错误发生在哪个组件呢?
黄舟2017-05-15 17:07:59
Generally, you can see more than 80% of the causes and locations of errors in the debugging console in the browser. You can find the cause of your own code and change it yourself. Generally, the value cannot be obtained, and the code logic is wrong. For errors thrown by angularr, it is recommended to go to angular's official website and make good use of the search engine. If you have experienced colleagues among you, you can also ask.
In experience, note that all dependencies are injected. The error is very obvious. Pay attention to where the data comes from (obtained from the interface, local storage) and what it is used for. Basically, it is some array operations. Make the process clear.
Especially the kind that has been componentized, it is very convenient to follow the gourd, but you still have to understand the principle yourself.
Let’s talk about the structure. The js file of a module is written in the module file directory. The file directory is used for natural separation and isolation, which makes it easier to find code debugging errors.
I don’t know much about the final unit test, but I express my interest in it and will take a look at it when I have time.