angularjs-styleguide
angularjs-styleguide copied to clipboard
Can't access form object in component's controller
I have a form like:
<!-- myTemplate.html -->
<form name="myForm">
...
</form>
And the controller like:
import template from './myTemplate.html';
export const MyForm = {
template,
controller: class MyForm {
...
}
}
When I try to access this.myForm in a controller method I get that it's undefined. I've also tried to name the form with $ctrl.myForm in the template but with no luck (base on the best answer in this question on SO)
I'm using webpack4 to compile.
Interesting, I can access the this.myForm by following the best answer in that question on SO and I am using webpack4 as well.