Amp-List height set dynamically on page load.
Description
Currently I have to give fixed height to the amp-list. But I want that list should get height based on the content loaded inside the list. I have a json data which gets validated on page load. There is a possibility that I may get empty array in that case list should take height as 0 on page load. And If I get data on page load, then it gets height based on the data loaded.
Reproduction Steps
- Get data from json on page load and bind it to the listt.
- If data returned is empty array then height should be 0.
- if I have data on page load then list should take content height.
- Please help to resolve this issue.
Relevant Logs
No response
Browser(s) Affected
No response
OS(s) Affected
No response
Device(s) Affected
No response
AMP Version Affected
No response
Anyone has any update on this issue?
Dupe of https://github.com/ampproject/amphtml/issues/26873
do we having working example for this. because when I am setting layout ="container". I am getting following error :
Experiment "amp-list-layout-container" is not turned on.
and data is not loading.
@caroqliu I am getting the same error when I am trying to test https://github.com/ampproject/amphtml/blob/main/examples/amp-list-layout-container.amp.html this example on my local machine. Could you please let me know if this is possible or not?
@caroqliu I am getting the same error when I am trying to test https://github.com/ampproject/amphtml/blob/main/examples/amp-list-layout-container.amp.html this example on my local machine. Could you please let me know if this is possible or not?
As per the discussion in #26873, we will likely move to remove requirement of the experiment amp-list-layout-container to get the feature enabled by default. I'd recommend following that issue for updates.
In the mean time you have a few options:
- enable the experiment for local development by calling
AMP.toggleExperiment('amp-list-layout-container')in the console - enable the experiment for users by following the instructions at "Enable experimental features"
- use the similar, more light-weight, and recently launched
amp-render