>Hi everybody,
>
>Is there a way to define an empty array that is going to hold objects of the predefined structure?
>
>Say, I want my object to be
>
>{fileName: "someName", key: "some unique string", type: "some type", content: file}
>
>and
>
>$scope.attachments.body.rows = [{these types of objects}];
>
>
>
>The question is - how can I define my $scope.attachments.body.rows to be this type of array of objects?
>
>I have it currently defined as [] but I am getting some errors because my directive expects certain structure of rows in that array. Originally I had that as part of my model and just passed it when I created a model, but now I removed it from the model and yet still want to create an array in JavaScript that is going to hold that structure.
>
>I did a few quick searches but didn't find an answer to this question.
Something like this, if I understood your question right?...
var YourVariable = new Array(new AnObject());
function AnObject() {
this.filename = "";
this.key = "";
this.type = "";
this.content = "";
}
----------------------------------
António Tavares Lopes