Angularjs get request for a huge json file

后端 未结 2 384
没有蜡笔的小新
没有蜡笔的小新 2021-01-18 06:17

I need to display some data from a database to the user. The data is in a json file and has a pretty huge size. The size of json file is roughly around 15MB. I created a ser

2条回答
  •  北荒
    北荒 (楼主)
    2021-01-18 06:29

    Based on your requirements of dealing with essentially a huge JSON payload. FWIW you have two options:

    • Your server supports HTTP/JSON streaming:

      create an angular onreadystatechange handler and use a streaming JSON parser like oboe.js

    • Your server DOES NOT support HTTP/JSON streaming

      Do what everyone else is suggesting and provide a paginated access to that payload so that the browser can load it in chunks on demand.

提交回复
热议问题