简体   繁体   English

升级到v1.3.6后Angularjs解析错误

[英]Angularjs parse error after upgrade to v1.3.6

I just upgraded my angularjs version from v1.2.15 to v1.3.6 and it broke a piece of code on my e-commerce site. 我刚刚将我的angularjs版本从v1.2.15升级到v1.3.6,它破坏了我电子商务网站上的一段代码。 (Wordpress, Woocommerce, cart page) (Wordpress,Woocommerce,购物车页面)

I'm getting a parse error on this: 我在此上解析错误:

{{initarray.<?php echo $cart_item_key; ?>.amount}}

Previously this would display the amount of a certain item in the cart, which is be incremental. 以前,这会显示购物车中某个项目的数量,该数量是增量的。 However the angularjs upgrade to v1.3.6 can no longer parse this code. 但是,将angularjs升级到v1.3.6不再能够解析此代码。

The result on the page looks like this: 页面上的结果如下所示:

{{initarray.77596958a3b31761962c8b2393cfcfb2.amount}} 

The error I'm getting is: 我得到的错误是:

Syntax Error: Token '.77596958' is an unexpected token at column 10 of the expression 
[initarray.77596958a3b31761962c8b2393cfcfb2.amount] starting at [.77596958a3b31761962c8b2393cfcfb2.amount].

I didn't write this code, so I'm unfamiliar with the array syntax this programmer used, it must not have been ideal because this newer version of ng doesn't like it. 我没有编写此代码,所以我不熟悉该程序员使用的数组语法,它一定不是理想的,因为ng的较新版本不喜欢它。

Any guidance is appreciated, ty. 任何指导,不胜感激。

Change it to this: 更改为此:

{{initarray['<?php echo $cart_item_key; ?>'].amount}}

Edit: Added single quotes around the php echo and it works. 编辑:在php echo周围添加了单引号,并且可以使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM