How do I debug an AngularJS binding like {{expression}} without any browser addon? I can't use any browser dev tools add-on except Firebug. So, I want to check if the binding expression really has some value from my controller. How do I check this?
如何在没有任何浏览器插件的情况下调试像{{expression}}这样的AngularJS绑定?我不能使用除Firebug之外的任何浏览器开发工具加载项。所以,我想检查绑定表达式是否确实具有来自我的控制器的某些值。我该如何检查?
(function() {
var app= angular.module("myApp");
var appCtrl = function($scope,$rootScope,$window,$miscService)
{
$scope.myUrl = "http://www.google.com";
}
In the template
在模板中
<a href="{{myUrl}}" target="_blank">Google</a>
my question is, is it possible to debug my AngularJS expression's value within the HTML?
我的问题是,是否可以在HTML中调试我的AngularJS表达式的值?
3 个解决方案
#1
1
You can print your value in the page with
您可以在页面中打印您的值
<pre>{{value | json}}</pre>
"json" here is used as Filter and inside AngularJS.
这里的“json”用作Filter和AngularJS。
You can read this : https://*.com/a/27424876/861206
您可以阅读:https://*.com/a/27424876/861206
#2
1
Yes, you can do it with {{ yourVar }}
是的,您可以使用{{yourVar}}来完成
If you put your variable inside curly braces, the value of the variable will appear.
如果将变量放在花括号中,则会显示变量的值。
value of href = {{myUrl}}
You have a DEMO here = JSFIDDLE
你有一个DEMO = JSFIDDLE
#3
0
just print in html <pre>{{myurl}}</pre>
, or try to inspect the code and add breakpoints to the source archive, so the local debuggers stops in the code
只需在html
{{myurl}} 中打印,或尝试检查代码并在源存档中添加断点,以便本地调试器在代码中停止
i eddited the fiddle it now works, the angular embed was not correct because it has to load using https
我编辑它现在工作的小提琴,角嵌入是不正确的,因为它必须使用https加载
#1
1
You can print your value in the page with
您可以在页面中打印您的值
<pre>{{value | json}}</pre>
"json" here is used as Filter and inside AngularJS.
这里的“json”用作Filter和AngularJS。
You can read this : https://*.com/a/27424876/861206
您可以阅读:https://*.com/a/27424876/861206
#2
1
Yes, you can do it with {{ yourVar }}
是的,您可以使用{{yourVar}}来完成
If you put your variable inside curly braces, the value of the variable will appear.
如果将变量放在花括号中,则会显示变量的值。
value of href = {{myUrl}}
You have a DEMO here = JSFIDDLE
你有一个DEMO = JSFIDDLE
#3
0
just print in html <pre>{{myurl}}</pre>
, or try to inspect the code and add breakpoints to the source archive, so the local debuggers stops in the code
只需在html
{{myurl}} 中打印,或尝试检查代码并在源存档中添加断点,以便本地调试器在代码中停止
i eddited the fiddle it now works, the angular embed was not correct because it has to load using https
我编辑它现在工作的小提琴,角嵌入是不正确的,因为它必须使用https加载