Node v7.7.2
Npm v4.1.2
Webpack v2.2.1
Browser: verified in Chrome 56 and FF 50
Language: ESNext
I am having trouble getting exported functions to work as a view model for a component that gets loaded up by a router. I'm in the process of migrating things over from an older Angular 1.x project, and want to limit the changes I have to make to the code base for now (hence exporting functions rather than use classes). Here's what I have that isn't working the way I would expect (bindings not binding, and lifecycle functions not being called):
export function Home() {
this.message = 'hello world';
this.attached = function () {
console.log('home attached');
}
}
I did try to build it up by attaching functions to the prototype, and that seemed to work ok. Is the above style not supported?
The framework is optimized for performance in various ways that involve using the prototype.
Good to know, thank you for the quick feedback!
It would be nice if the function style is supported in aurelia for view models
+1