javascript

Angular: How to use variable in HTML getElementById  #angularjs #reactjs

  • But when I use ng-click, the following error is shown: Error: v0 is undefined.
  • Yes the interpolation error mentioned by the other replies is displayed.
  • could you create a fiddle/plunker of your code, v0 undefined should not be due to the code shared – Deep 1 hour ago
  • From the docs: Interpolations for HTML DOM event attributes are disallowed.
  • These are the first two error lines: Error: v0 is undefined anonymous/fn@ ajax.googleapis.com/ajax/libs/angularjs/1.5.6/a line 231 > Function:2:738 – sandboxj 1 hour ago

I am using ng-repeat to create multiple divs with modals, which I open by getElementById. When I hardcode the id (e.g. ‘modalId’), it works but not if I try to use a variable. How do I make it work?

@ng_real_ninja: Angular: How to use variable in HTML getElementById #angularjs #reactjs

I am using ng-repeat to create multiple divs with modals, which I open by getElementById. When I hardcode the id (e.g. ‘modalId’), it works but not if I try to use a variable. How do I make it work?

The p.id I want to use (line 2) is an int.

check this

you must be getting the below warning in your console.

Interpolations for HTML DOM event attributes are disallowed.

This error occurs when one tries to create a binding for event handler attributes like onclick, onload, onsubmit, etc.

There is no practical value in binding to these attributes and doing so only exposes your application to security vulnerabilities like XSS. For these reasons binding to event handler attributes (all attributes that start with on and formaction attribute) is not supported.

javascript

You might also like More from author

Comments are closed, but trackbacks and pingbacks are open.