初めてAngularJSを試しています。 $http.post("url", data)
機能を使用すると、Error: $http is not defined
コンソールメッセージが表示されます。
私のHTMLページの上部には、他のすべてのJSのインポート後にAngularJSが含まれています。
私もこのようになります依存関係など私のスクリプトの輸入セクションをウィジェットに起因する他のJavaScriptライブラリが含まれている:私は、サーバーにいくつかのデータを送信するために使用しているコントローラを持って
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
<script src="http://www.trirand.com/blog/jqgrid/js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="http://www.trirand.com/blog/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js"></script>
:
function FormCtrl($scope) {
$scope.sendData = function(){
var data = "firstName=" + $scope.firstName + "&" +
"lastName=" + $scope.lastName + "&" +
"address=" + $scope.address + "&" +
"postcode=" + $scope.postcode;
$http.post("/data/person/put", data);
};
}
ボタンにはsendData
機能が付いています。 $http.post(...)
への呼び出しまでは、すべて正常に動作し、コンソールはエラーを出力します。
完全なエラーリストは次のとおりです。
Error: $http is not defined
[email protected]://localhost:8080/angularjs/:96
Mc/x/<@https://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js:71
ec[c]</</</<@https://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js:142
[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js:87
[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js:87
ec[c]</</<@https://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js:142
[email protected]://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js:63
c.event.add/[email protected]://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js:57
https://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js
Line 61
私は$http.post
機能を使用するようにAngularJSを設定するには、何かを行う必要がありますか?
私はまっすぐここにドキュメントのAngularJS ショートカットメソッドセクションから使用を持ち上げる:http://docs.angularjs.org/api/ng.$http
誰でも助けることができますか?
おかげ アダム
をお読みください。迅速な対応ありがとうございました。だから私はあなたの答えをまだ受け入れることができない速い。でも私はする。再度、感謝します! –
注射による合併症に関するノートをhttp://docs.angularjs.org/tutorial/step_05で読むことができます –