Dependency Injection Constructor that takes arguments
问题 I'm building an Aurelia app that uses "Models" for every type of data object. All my Models look something like this: export class Item { id = null; name = ''; description = ''; constructor (data) { Object.assign(this, data); } } And I later create objects like this: export class SomeViewModel { activate () { this.myItem = new Item({ name: 'My Item!', description: 'This is my item. It will be initialized with these properties.' }); } } I got the Object.assign() bit from an article I read and