Angularjs 如何访问已传递给函数的多个参数?
我有以下类似的功能,可以成功访问functions参数: HTML: 角度:Angularjs 如何访问已传递给函数的多个参数?,angularjs,Angularjs,我有以下类似的功能,可以成功访问functions参数: HTML: 角度: $scope.showContent = function(attrs){ $http({ url: attrs, method: "POST" }) .success(function (data, status, headers, config) { $scope.my_content = data; }) .error(
$scope.showContent = function(attrs){
$http({
url: attrs,
method: "POST"
})
.success(function (data, status, headers, config) {
$scope.my_content = data;
})
.error(function (data, status, headers, config) { $scope.status = status; });
};
但是如果我有多个参数呢?例如:
<div ng-click="showContent('parameter1', 'parameter2')">
我想我可以做一些像
$scope.param1=attrs[0]
之类的事情,但那不起作用。如何访问这两个参数?像$scope.showContent=function(p1,p2){
那样声明函数,像$scope.param1=p1那样使用它们
或者在函数内部使用,如$scope.param1=arguments[0]
参数
对象的文档:我现在意识到这是一个愚蠢的问题,但谢谢你的回答!我还是个新手。