The amp-bind is made in such a way that any document using it has a mutable JSON data or state. This data can be manipulated using amp-state. Your data is not evaluated on page load but dynamically evaluated along with user input. It has various state and they have their own variable. In this article, we will talk about the initial state of the elements.
The initial of an amp-state variable is always NULL but it can be changed when the user interacts with the page.
Setup: To use amp-bind-macro in our AMP page we have to import amp-bind script in the head of the document.
In the above example, one greeting is bind inside an amp-state via a JSON string. When the user triggers an AMP.setState(…) action, both bindings will be evaluated resulting in the first binding displaying a null value.
Please Login to comment...