amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

AMP -Bind Issue and Web service Call

Open gtonysam opened this issue 8 years ago • 2 comments

What's the issue?

Briefly describe the bug/feature request.

1)Hi we are using amp-state to bind the values to the url. We have as many as 20 paramters to pass to the url. We tried amp-bind macro as well to add values but still the below issue comes always- amp-bind :Expression compile error in Expression size () exceeds max (50). Please reduce number of operands. Attached the file, need to convert to HTML and if we add one more operand in [HREF], the issue occurs

2)How to call REST API from AMP amp-macros-06Feb.old.-.Copy.txt

gtonysam avatar Feb 11 '18 08:02 gtonysam

Looks like the long expression is in the following macros:

<amp-bind-macro id="dynamicDate" arguments="date" expression=
    "searchForm.departureDateURL + searchForm.departureDate[0] +
    searchForm.departureMonthURL + date[1] + searchForm.departureYearURL + date[2]" />

<amp-bind-macro id="dynamicURL" arguments=""  expression=
    "searchForm.baseurl + searchForm.tripType + 
    dynamicDate(searchForm.departureDate)" />

The submit button is an <a [href]="dynamicURL()">. Instead of using an <a> tag with a dynamic href, can you use amp-form instead with AMP-Redirect-To to navigate?

dreamofabear avatar Feb 22 '18 19:02 dreamofabear

Some references: https://www.ampproject.org/docs/reference/components/amp-form https://ampbyexample.com/samples_templates/product_page/

Please reopen if this won't work for your use case.

dreamofabear avatar Feb 22 '18 19:02 dreamofabear