Skip to content

amp-bind can't set state for variables inside amp-state #7399

@kul3r4

Description

@kul3r4

At the moment it's only possible to set the values for global variables via AMP.setState but not for variables declared inside amp-state.

Example:
AMP.setState(foo=123) -> is working

AMP.setState(myAmpState.foo=123)
where

<amp-state id="myAmpState">
      <script type="application/json">
      {
          "foo": "234"
      }
.....

is not working.
Current workaround is setting default variables.

@choumx @ericlindley-g

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions