1

请在此处查看 plunkr

有两个recaptcha 代码块,一个在partialpartial_list.html中,另一个在index.html 中。内部部分未显示,我认为可能是因为 angular 阻止加载外部脚本。我怎样才能让它在部分内部工作?

编辑

作为评论,请参阅下面的代码。

索引.html:

<!DOCTYPE HTML>
<html ng-app="myApp">
<head>
    <meta charset="utf-8">
    <script type="text/javascript" src="http://code.angularjs.org/1.0.1/angular-1.0.1.js"></script>
    <script type="text/javascript" src="app.js"></script>
    <script type="text/javascript" src="controllers.js"></script>
    <link rel="stylesheet" href="bootstrap.min.css">
</head>
<body>
<div class="container">
    <div ng-controller="FriendCtrl">
        <div ng-view></div>
    </div>
</div>

<h2>in index.html</h2>
<form name="editForm" class="form-horizontal" ng-submit="saveFriend()">
  <script type="text/javascript"
                src="http://www.google.com/recaptcha/api/challenge?k=6LfRgOMSAAAAAPRKoWemiQCZdhWBy2xgfWsZ_xUe">
        </script>
        <noscript>
            <iframe src="http://www.google.com/recaptcha/api/noscript?k=6LfRgOMSAAAAAPRKoWemiQCZdhWBy2xgfWsZ_xUe"
                    height="300" width="500" frameborder="0"></iframe><br>
            <textarea name="recaptcha_challenge_field" rows="3" cols="40">
            </textarea>
            <input type="hidden" name="recaptcha_response_field"
                   value="manual_challenge">
        </noscript>
</form>

</body>
</html>

应用程序.js

var app = angular.module('myApp', []);

app.config(['$routeProvider', function($routeProvider) {
    $routeProvider.when('/edit/:friendId', {
        templateUrl: 'partial_edit.html',
        controller: FriendEditCtrl
    });
    $routeProvider.when('/list', {
        templateUrl: 'partial_list.html',
        controller: FriendListCtrl
    });
    $routeProvider.otherwise({ redirectTo: '/list' });
}]);

部分列表.html

<h2>In partial</h2>

<form name="editForm" class="form-horizontal" ng-submit="saveFriend()">
  <script type="text/javascript"
                src="http://www.google.com/recaptcha/api/challenge?k=6LfRgOMSAAAAAPRKoWemiQCZdhWBy2xgfWsZ_xUe">
        </script>
        <noscript>
            <iframe src="http://www.google.com/recaptcha/api/noscript?k=6LfRgOMSAAAAAPRKoWemiQCZdhWBy2xgfWsZ_xUe"
                    height="300" width="500" frameborder="0"></iframe><br>
            <textarea name="recaptcha_challenge_field" rows="3" cols="40">
            </textarea>
            <input type="hidden" name="recaptcha_response_field"
                   value="manual_challenge">
        </noscript>
</form>

控制器.js

function FriendCtrl($scope) {
}

function FriendListCtrl($scope) {
}

function FriendEditCtrl($scope, $routeParams, $location) {

}
4

0 回答 0