简体   繁体   English

指令不起作用 - 调试步骤?

[英]Directive is not working - debug steps?

What are steps on debugging angular directives? 调试角度指令的步骤是什么?

I've directive in HTML and it's JS definition. 我在HTML中有指令,它是JS的定义。

I can set breakpoint on directive definition, and script stops there on load, showing fact that directive was loaded. 我可以在指令定义上设置断点,脚本在加载时停止,显示指令已加载的事实。

I can enable logging by setting 我可以通过设置启用日志记录

app.config([ "$logProvider", function ($logProvider) {
    $logProvider.debugEnabled(true);
});

Sometimes it shows useful error messages. 有时它会显示有用的错误消息。

But all that is not enough, often directive is just not being processed at HTML at all, and no log messages appear. 但是所有这些还不够,通常是指令根本就没有在HTML处理,也没有出现日志消息。

How do one test that directive is actually loaded (for example, by chrome console)? 如何测试该指令实际加载(例如,通过chrome控制台)?

And where should one look to completly check directive processing pipeline for bugs? 在哪里应该完全检查指令处理管道的错误?

您可以尝试使用ng-inspector插件进行谷歌浏览器调试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM