2016-09-01 4 views
0

Ich arbeite in einem Projekt, das ich eckig mit paypal plus integrieren muss. Aber wenn ich das Skript (paypal-Skript) in ein HTML setze, erkennt der Angular nicht die PAYPAL.apps.PPP Skriptvariable Ich erhalte diesen Fehler an der Konsole.AngularJS funktioniert nicht mit Paypal

angular.js:13550 ReferenceError: PAYPAL is not defined 
at eval (eval at globalEval (http://localhost:9000/bower_components/jquery/dist/jquery.js:343:5), <anonymous>:1:23) 
at Function.globalEval (http://localhost:9000/bower_components/jquery/dist/jquery.js:343:5) 
at domManip (http://localhost:9000/bower_components/jquery/dist/jquery.js:5291:15) 
at jQuery.append (http://localhost:9000/bower_components/jquery/dist/jquery.js:5431:10) 
at jQuery.<anonymous> (http://localhost:9000/bower_components/jquery/dist/jquery.js:5525:18) 
at access (http://localhost:9000/bower_components/jquery/dist/jquery.js:3614:8) 
at jQuery.html (http://localhost:9000/bower_components/jquery/dist/jquery.js:5492:10) 
at link (http://localhost:9000/bower_components/angular/angular.js:25866:18) 
at invokeLinkFn (http://localhost:9000/bower_components/angular/angular.js:9694:9) 
at nodeLinkFn (http://localhost:9000/bower_components/angular/angular.js:9093:11) <div ng-include="'app/account/payment/panel/paypal.html'" class="ng-scope">" 

HTML-Code:

<script src="https://www.paypalobjects.com/webstatic/ppplus/ppplus.min.js" type="text/javascript"></script> 
<script type="application/javascript"> 
var ppp = PAYPAL.apps.PPP({"approvalUrl": '.$approvalUrl.',"placeholder": "ppplus","mode": "sandbox"}); 
</script> 
<div id="ppplus"> </div> 
<button type="submit" 
id="continueButton" 
onclick="ppp.doContinue(); return false;">Continuar 
</button> 

jemand hier wissen, wie paypal mit Skripten Winkel- oder Importen anderer zu integrieren, um in der Anwendung verwendet werden. o/

+0

Es ist wie die paypal js scheint nicht immer geladen oder die Winkel Skript ausgeführt wird, bevor es geladen wird. – plong0

+0

Das 'PAYPAL' arbeitet mit' jQuery'. Haben Sie 'jQuery'-Skript in die Kopfzeile eingefügt? –

+0

@ plong0 Ich habe das Skript in der index.html Seite und es funktioniert! Danke Mann für die schnelle Antwort! : P –

Antwort

1

Es scheint, dass die paypal js nicht geladen wird oder das angular Skript läuft, bevor es geladen wird.

habe ich das Skript im html index.html :)

0

Sie müssen die jQuery-Bibliothek hinzufügen. Sie sollten sie vor der PAYPAL-Bibliothek einfügen.

+2

Willkommen bei SO. Ich würde erwägen, deine Antwort ein wenig zu erweitern. –