我必须使用jquery和angularjs提交值数组。当我点击提交按钮时,我只获得第一个数组值。如何使用ng-model获取所有数组值。这是我的所有代码https://jsfiddle.net/rijo/6dLxhr7j/ 脚本代码如下所示
#include <armadillo>
int main (int argc, char* argv[])
{
size_t num_slices = 9;
arma::icube A (3, 3, num_slices);
arma::icube B (3, 3, num_slices);
A.zeros();
B.randn();
A.print("Cube A :\n");
B.print("Cube B :\n");
for (int s = 0; s < num_slices; ++s)
A.slice(s)(arma::span::all, arma::span(0, 1)) =
B.slice(s)(arma::span::all, arma::span(1, 2));
A.print("Cube A :\n");
B.print("Cube B :\n");
return 0;
}
请任何人帮忙..谢谢!
答案 0 :(得分:-1)
您必须将数据作为对象发布,将数组作为对象属性值传递。在这种情况下,我使用的是$http.post
快捷方式。
function buildParam(){
// write any needed logic to get, build your array
// maybe a loop extracting values from collection, etc.
var myArray = []; // here your array of values, objects, etc.
return myArray;
}
$scope.onSubmit = function(){
sum = {
myAttr: buildParam()
};
$http.post('admin_controller.php', sum).then(
function(response) {
console.log('ok');
}
);
}