在Angular指令中查找性能问题

时间:2015-06-28 16:46:47

标签: javascript angularjs performance

我创建了一个Angular指令,现在我希望在指令与大量数据集一起使用时提高性能。

我使用Chrome的时间线工具来监控我的指令加载时会发生什么,但是我无法理解究竟是什么花了〜2秒,因为无论我在哪里点击,我都会看到Angular调用。

enter image description here

我做了demo in plunkr所以你可以自己做测试。

指令的快速文档(如果需要,请查看完整文档here。)

<div
    angular-multi-select       <---- directive
    selection-mode="single"    <---- single or multi
    input-model="testdata"     <---- data that is going to be rendered
    output-model="output"      <---- array of selected items
    item-label="{{ name }}"    <---- template for each rendered item
    button-template="angular-multi-select-btn-data.htm"   <---- template for the directive itself
    button-label="{{ txt[name] || 'Other' }}"   <----- template for how each selected item should be rendered in the directive dropdown
    tick-property="checked">   <---- property containing the un/checked marker
</div>

如何检查究竟是什么导致我的指令变慢?

0 个答案:

没有答案