Recaptcha(外部脚本)里面有角度的部分

时间:2013-06-29 02:19:37

标签: javascript angularjs recaptcha

请参阅plunkr here

有两个重访代码块,一个在部分partial_list.html内,另一个在index.html中。部分内部不显示,我假设可能是因为angular阻止加载外部脚本。如何让它在局部内部工作?

修改

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

的index.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>

app.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' });
}]);

partial_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>

controller.js

function FriendCtrl($scope) {
}

function FriendListCtrl($scope) {
}

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

}

0 个答案:

没有答案