amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

[amp-list] fallback workaround under HTTP Status Code as 200

Open leonahliang90 opened this issue 8 years ago • 3 comments

I have read the documentation of <amp-list> and issue #9860

And I realize, the <div fallback> will only be trigged if the HTTP Status Code returned error, so, I am asking are there any workaround which I can use to display "No Data Matched" based on the length of array returned as 0, and HTTP Status Code returned as 200.

leonahliang90 avatar Jan 10 '18 10:01 leonahliang90

This should be possible if your JSON data is a single item which itself has an array of items. Then normal conditional mustache templates can be used to render based on the length of the array.

@sebaperez @kul3r4 Do you have a snippet anywhere that does something similar?

aghassemi avatar Jan 11 '18 23:01 aghassemi

We don't but that would be a nice thing to have!

kul3r4 avatar Jan 14 '18 20:01 kul3r4

@leonalicious Please see the sample added by @kul3r4: https://github.com/ampproject/amp-by-example/pull/1124

aghassemi avatar Jan 16 '18 01:01 aghassemi