How can directives be lazy loaded in angularjs?

后端 未结 4 1173
独厮守ぢ
独厮守ぢ 2020-12-30 01:58

I\'m working with angularjs and I want to be able to load directives as and when they are needed instead of having all of them loaded at the start of the page. I\'m trying

4条回答
  •  自闭症患者
    2020-12-30 02:54

    I am not sure how using a angularJS directive will be an appropriate answer

    I have done the following and it works flawlessly

    • Use mustache list to decide list item template.(https://github.com/janl/mustache.js/)
    • On load of your application apis should load only 10 -50 records, depending on your content.
    • On scroll of list as soon as you are about to reach to end, fire next apis call form next 20 items and so on.
    • If your data is not changing, you can store it locally and repopulate.

    • keep fetching latest records and ad it locally.

提交回复
热议问题