gpt4 book ai didi

angularjs - 更新到 1.2 后,带有变量的表单操作无效

转载 作者:行者123 更新时间:2023-12-03 13:22:09 30 4
gpt4 key购买 nike

我在我之前版本的 AngularJS 中生成了一个表单操作使用此代码:

<form action="{{ api }}/products/image">

但是,我刚刚更新,现在显然太松了。

Error while interpolating: {{ api }}/products/image Strict Contextual Escaping disallows interpolations that concatenate multiple expressions when a trusted value is required.



如何在 1.2.4 中实现相同的功能? ?

最佳答案

从 Angular 1.2.x 开始,您可以 bind only one expression as URL .

因此,在您的 Controller 上,执行以下操作:

$scope.actionUrl = $scope.api + '/products/image';

在模板中:
<form action="{{ actionUrl }}">

更新

正如@Fourth 所建议的:
<form action="{{ api + '/products/image' }}">

关于angularjs - 更新到 1.2 后,带有变量的表单操作无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20552395/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com