1
amp-position-observer를 사용하여 AMP 상태를 설정할 수 있습니까?Amp-html - amp-position-observer를 사용하여 amp-bind에서 사용되는 AMP.setState()를 호출 할 수 있습니까?
내가 성공하지 않고 다음 코드를 시도 :
이<!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>
채택 된 솔루션은 관련 GitHub 스레드에 설명되어 있습니다. https://github.com/ampproject/amphtml/issues/11735 – Gab