Closed GimmeDaKitty closed 5 years ago
Apart from the doc issue, since you are using TypeScript, you should try @autoinject
which can remove the explicit deps list. It is documented in the same page you were reading.
@3cp yup that is indeed an option! I was just puzzled that using the normal inject
didn't work! :D
I’ll add some clarification to the docs, no problem. It’s a good point.
@EisenbergEffect awesome, thanks!
I am learning Aurelia and I have been bumping my head the last two days with the "xxxx is not a function" error and strange undefined and empty objects.
After much head scratching I realized that when you inject classes via the
@inject
decorator, these need to be specified in the same order in the constructor. I don't have a lot of experience with Javascript and come from the C# world so this was not obvious to me.The docs say:
In my view this ordering should be explicitly mentioned . 'Matches the list of dependencies' does not say anything about order.
Below my specs just in case:
Library Version: aurelia-cli v1.0.1 Environment
Operating System: Windows 10
Node Version: v10.15.3
NPM Version: 6.9.0
Browser: Chrome Version 75.0.3770.100 (Official Build) (32-bit)
Language: Typescript 3.1
Loader/bundler: Webpack