I have a very simple AMP page that uses amp-bind
. However, the validator always shows this message:
The extension 'amp-bind' was found on this page, but is unused. Please remove this extension."
My page does use amp-bind
. The code for the page is here:
<!doctype html>
<html ⚡>
<head>
<meta charset="utf-8">
<script async src="https://cdn.ampproject.org/v0.js"></script>
<link rel="canonical" href="http://localhost/amp-bind.html" />
<title>AMP bind test</title>
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<script async custom-element="amp-bind" src="https://cdn.ampproject.org/v0/amp-bind-0.1.js"></script>
</head>
<body class="main">
<h3>amp-bind example</h3>
<p [text]="'Hello '+username">Hello World</p>
<button on="tap:AMP.setState({username: 'rodders'})">Say Hello</button>
</body>
</html>
Can anyone explain why this message shows, and what can I do to remove it?
This is a bug that was recently fixed. A workaround is to include an <amp-state>
element on your page. Sorry about that!