http帖子没有输入到操作字段

时间:2022-09-25 14:51:48

I have a HTTP Post form that receives info from AngularJS (that takes it from the PHP BE). I use the following code sample:

我有一个HTTP Post表单,它从AngularJS接收信息(从PHP BE获取)。我使用以下代码示例:

<form method="post" action="{{aw('TI.sup');}}">
<input type='hidden' name='bla' value="{{aw('TI.sup');}}" />
<input type="submit" class="button s-button"  value="bla" />
</form>

After page is loaded, I see the following result:

加载页面后,我看到以下结果:

<form method="post" class="ng-pristine ng-valid">
<input type="hidden" name="bla" value="https://thisis.the/url">

Strings without 'https:' work fine.

没有'https:'的字符串工作正常。

Update

The problem was with $sce, and has slightly changed after I Added a function to the controller.

问题出在$ sce上,并且在我向控制器添加了一个功能之后略有改变。

now I'm getting:

现在我得到了:

<form method="post" action="https://thisis.the/url" class="ng-pristine ng-valid"> 

Update, take 2

更新,拿2

The form won't respond to submit because the previous URL was blank (before Angular changed it). I decided to take the info from PHP itself, but the following jquery will also do the trick:

表单将不响应提交,因为以前的URL为空(在Angular更改之前)。我决定从PHP本身获取信息,但是下面的jquery也可以解决这个问题:

$("#FormID").submit();

Thanks,

Dana.

1 个解决方案

#1


2  

You are facing a $sce:insecurl error , probably because the action URL is from other domain/protocol.

您正面临$ sce:insecurl错误,可能是因为操作URL来自其他域/协议。

From $sce:insecurl error docs:

Processing of a Resource from Untrusted Source Blocked

处理来自不受信任源的资源被阻止

...

To load templates from other domains and/or protocols, either adjust the whitelist/ blacklist or wrap the URL with a call to $sce.trustAsResourceUrl.

要从其他域和/或协议加载模板,请调整白名单/黑名单或通过调用$ sce.trustAsResourceUrl来包装URL。

Here is an an example: http://jsbin.com/disef/2/edit

这是一个例子:http://jsbin.com/disef/2/edit

function ctrl($scope, $sce){
  $scope.aw = function() {
    return $sce.trustAsResourceUrl("https://thisis.the/url");    
  }
};

#1


2  

You are facing a $sce:insecurl error , probably because the action URL is from other domain/protocol.

您正面临$ sce:insecurl错误,可能是因为操作URL来自其他域/协议。

From $sce:insecurl error docs:

Processing of a Resource from Untrusted Source Blocked

处理来自不受信任源的资源被阻止

...

To load templates from other domains and/or protocols, either adjust the whitelist/ blacklist or wrap the URL with a call to $sce.trustAsResourceUrl.

要从其他域和/或协议加载模板,请调整白名单/黑名单或通过调用$ sce.trustAsResourceUrl来包装URL。

Here is an an example: http://jsbin.com/disef/2/edit

这是一个例子:http://jsbin.com/disef/2/edit

function ctrl($scope, $sce){
  $scope.aw = function() {
    return $sce.trustAsResourceUrl("https://thisis.the/url");    
  }
};