Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Empty array of objects predefined structure
Message
 
 
To
All
General information
Forum:
Javascript
Category:
Cross-browser compatibility
Title:
Empty array of objects predefined structure
Miscellaneous
Thread ID:
01648635
Message ID:
01648635
Views:
34
UPDATE. Looks like just keeping it as [] worked for me. I originally tried [{}] which didn't.

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.
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform