Sigh. I’ve taken a look in to app.bundle.js
and messed around a bit. My explanation:
So I am using typescript so it bundles everything to app.bundle.js
. While looking around in that I saw the following.
A working PictureCollection
model was required like this.
var picture_collection_1 = require('../../models/picture-collection');
My Picture
model that wasn’t working was required like this.
var Picture_1 = require('../../models/Picture');
So I tried to look for the differences by loggin them
console.log('collection', picture_collection_1);
console.log('picture', Picture_1);
which logged the picture without a constructor function
I also noticed that the Picture_1
was capitalized and picture_collection_1
was not. So I looked to my import in the .ts
file. It was capitalized.
import {Picture} from '../../models/Picture';
So I changed it to
import {Picture} from '../../models/picture';
and it worked again. Thats because my file is called picture.ts
and not Picture.ts
… sometimes I hate programming …