如果我选择此选项:<select name="custType" ng-model="vm.custType" ng-options="c.name.toUpperCase() as c.name for c in vm.customers"...>
当ng-options中的表达式开始运行时,有没有办法进入devtools调试器?
不同的原因:
- 我想知道表达式在网页生命周期中的运行时间
- 我想知道c.name和vm.customers的当前值
表达生命周期中的一个时间点。
- 我还想知道在加载数据之前是否正在使用vm.customers。
答案 0 :(得分:0)
在angular src代码中找到ng-options指令并放置一个断点。
答案 1 :(得分:0)
尝试使用以下内容:
<强> HTML 强>
<select name="custType"
ng-model="vm.custType"
ng-options="c.name.toUpperCase() as c.name for debugCustomer(c) in vm.customers"
... ></select>
<强> JS 强>
...
$scope.debugCustomer = function (customer) {
console.log(customer);
debugger;
return customer;
}
...