【Angular】源于angular传参

来源:互联网 发布:移动工作站推荐 知乎 编辑:程序博客网 时间:2024/06/07 07:36

angualr的传参需要给到注意:
比如下面的getMajorType()方法,小括号里直接写4是会报错的,写成{LovId:4}这种形式就好了;(这里注意参量,首字母不能大写,这里是)

        questionService.getMajorType({LovId:4}).then(            function (res) {                $scope.majorList = [];                for (var i = 0; i < res.data.length; i++) {                    console.log("i:"+i);                    /*初始化:*/                    var a = {                        id: i,                        name: res.data[i].name                    };                    $scope.majorList.push(a);                }                console.log($scope.majorList);            }        );

还有这里:type的值可以为radio,check,cloze,tf,qa等;
这里写图片描述
熟悉并了解这种传参方式;

原创粉丝点击