Ich bin in der Lage aC# Methode aus einem Winkel Controller als solche zu nennen:2D-Array AngularJS bis C#
angualarjs:
$http.post('myC#Function', { "input": input)
.success(function (response) {
console.log("success send response: " + response);
})
.error(function (response) {
console("error send response: " + response);
});
C#
public string myC#Function(string input)
{
return "success";
}
Meine Probleme entsteht, wenn ich versuche, um ein 2D-Array vom Winkel- zum C# -Controller als solchem weiterzuleiten:
angularjs:
var my2DArray= [[], []];
// array is populated here (not shown)
$http.post('myC#Function', { "inputArray": my2DArray)
.success(function (response) {
console.log("success send response: " + response);
})
.error(function (response) {
console("error send response: " + response);
});
C#
public string myC#Function(string[,]input)
{
return "success";
}
Jede Hilfe appriciated würde.
im hinzufügen sollten den gleichen Fehler wie die andere Antwort zu bekommen. Ich erhalte einen NullReferenceException-Fehler, wenn ich versuche, die Eingabe [0] [0] von C# zurückzugeben, obwohl sie ausgefüllt ist. irgendwelche Ideen? – sgov090
Was haben Sie in Ihrem2DArrayInCSharp im Debug-Modus? Ist es richtig ? – Floc