如何在Angularjs $http.post中传递参数

在这里,我试图将“$scope.getCourse =’adobe’”的值传递给服务器,以便返回相应的课程详细信息,从中可以从响应数据中使用ng-repeat填充列表.但是当我插入“$scope.getCourse”以及servelet url时,以下代码失败.
var courseApp = angular.module('courseApp',[]);

courseApp.controller('courseCtrl',['$scope','$http',function($scope,$http){
    //$scope.getCourse = 'adobe'; //need to pass this value to the server;

    $http.post('javaServerlet',$scope.getCourse).success(function(data){
        $scope.result = data.MainTopic;
        $scope.lessons = data.CourSEOutline;
    })  
}])

来自服装的json格式


{ 
    "MainTopic": "Adobe","RunningTime": "6h11min","Description": "Course Description comes here","CourSEOutline":
    [ 
        { "Lessons" : "Lesson 1","Title" : "Introduction1","Duration" : "31m 27s"},{ "Lessons" : "Lesson 2","Title" : "Introduction2","Duration" : "56m 05s"},]
}

请让我知道如何实现上述情景,我对于角度很新.

您的数据应该是一个键/对,尝试:
$http.post('javaServerlet',{course: $scope.getCourse})

该变量将在参数过程中到达服务器

相关文章

ANGULAR.JS:NG-SELECTANDNG-OPTIONSPS:其实看英文文档比看中...
AngularJS中使用Chart.js制折线图与饼图实例  Chart.js 是...
IE浏览器兼容性后续前言 继续尝试解决IE浏览器兼容性问题,...
Angular实现下拉菜单多选写这篇文章时,引用文章地址如下:h...
在AngularJS应用中集成科大讯飞语音输入功能前言 根据项目...
Angular数据更新不及时问题探讨前言 在修复控制角标正确变...