将参数从隐藏字段传递给AngularJS

时间:2016-05-22 22:31:23

标签: javascript jquery angularjs

我是AngularJS的新手,所以我需要一些帮助。

我有两个隐藏的输入字段:

<input type="hidden" name="page_type" value="news">
<input type="hidden" name="page_id" value="24">

我需要将值传递给AngularJS Factory:

angular.module('commentService', [])

.factory('Comment', function($http) {

return {
    // get all the comments
    get : function(page_type, page_id) {
        return $http.get('/api/comments/index/'+page_type+'/'+page_id);
    }
}

});

0 个答案:

没有答案