Est-il possible de régler l'état AMP en utilisant amp-position-observateur?Amp-html - Puis-je utiliser amp-position-observer pour appeler AMP.setState() utilisé dans amp-bind?
J'ai essayé le code suivant sans succès:
<!doctype html>
<html ⚡>
<head>
<script async="" src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-bind" src="https://cdn.ampproject.org/v0/amp-bind-0.1.js"></script>
<script custom-element="amp-position-observer" src="https://cdn.ampproject.org/v0/amp-position-observer-0.1.js" async></script>
</head>
<body>
<p [text]="'Hello ' + foo">Hello World</p>
<div class="spacer"></div>
<amp-position-observer
intersection-ratios="0"
on="enter:AMP.setState({foo: 'amp-bind'})"
layout="nodisplay">
</amp-position-observer>
</body>
</html>
La solution adoptée est expliquée dans le fil GitHub relatif: https://github.com/ampproject/amphtml/issues/11735 – Gab