0

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?

rodders
  • 354
  • 1
  • 11
  • How do you interpret this line of your code: ` – Jay Gray Jul 16 '17 at 19:21
  • That's straight from the AMP docs, it's how to include the `amp-bind` component: https://www.ampproject.org/docs/reference/components/amp-bind – rodders Jul 16 '17 at 19:29
  • There are MANY custom-elements that you Can put in a document; but if you don't use them, the validator will warn you. I don't see where you are USING `bind` - maybe you left it out of your example. – Jay Gray Jul 16 '17 at 19:35
  • Sure, but the only thing this page does is use `amp-bind`. Check the docs if you can't see where it's being used! `

    Hello World

    ` `` Both of these lines use `amp-bind`
    – rodders Jul 16 '17 at 19:55
  • 1
    Hi, you have different errors on this page because the default value of the username variable is not set. To fix this, the best way would be to use the amp-state tag to specify a default. – kul3r4 Jul 17 '17 at 10:51
  • @kul3r4 & JayGray You were both on the right track, but not quite there. If I use `

    Hello World

    ` to take care of default, I still get same error. However, if I include simply `` (i.e. empty and no defaults) the error goes away.
    – rodders Jul 17 '17 at 12:30

1 Answers1

1

This is a bug that was recently fixed. A workaround is to include an <amp-state> element on your page. Sorry about that!

choumx
  • 151
  • 2