angularjs-styleguide icon indicating copy to clipboard operation
angularjs-styleguide copied to clipboard

Can't access form object in component's controller

Open franciscohanna92 opened this issue 7 years ago • 1 comments

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.

franciscohanna92 avatar Nov 01 '18 15:11 franciscohanna92

Interesting, I can access the this.myForm by following the best answer in that question on SO and I am using webpack4 as well.

khyamay avatar Nov 06 '18 11:11 khyamay