I am experimenting with the .component()
syntax in Angular 1.5.
It seems that the latest fashion is to code the controller in-line in the component rather that in a separate file, and I can see the advantage of that given that the component boilerplate is minimal.
The problem is that I having been coding my controllers as typescript classes and would like to continue doing so because that seems to be consistent with Angular2.
My best effort is something like this:
export let myComponent = {
template: ($element, $attrs) => {
return [
`<my-html>Bla</my-html>`
].join('')
},
controller: MyController
};
class MyController {
}
It works, but it's not elegant. Is there a better way?