question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Browser not updated after DOM is updated

See original GitHub issue

I’m submitting a … [x ] bug report => search github for a similar issue or PR before submitting [ ] feature request

Current behavior Angular does not update the browser once it runs.

For instance, if you have a label and an input, if you bind the “for” attribute of the label to the “id” attribute of the input via a passed input, the browser will not recognize that the two are linked because Angular does not let the browser know it updated the DOM.

EXAMPLE MARKUP

<myInput id="input1"></myInput>

EXAMPLE COMPONENT

@Input id: string;

EXAMPLE COMPONENT MARKUP

<label [for]="id">My Label</label> <input [id]="id" type="text" />

RESULT:

Clicking the label does not apply focus to the input. This can also be seen with labels of radio buttons and checkboxes, where clicking the label does not produce the desired default browser behavior of interacting with the associated element.

RESULT:

Clicking labels for related inputs does not interact with the assigned element.

Expected behavior Default browser behavior should be maintained when associated form elements via for and id.

Minimal reproduction of the problem with instructions http://plnkr.co/edit/jJeqHAbO7vNVLV9GTvQW?p=preview

What is the motivation / use case for changing the behavior? Should be able to use Angular to create dynamic components without having to reproduce default browser behavior. All form elements usingfor and id linking do not work as expected when given a dynamic value

Please tell us about your environment: Windows 7, VSCode, NodeJS, Angular Generator

  • Angular version: 2.0.X 2.3.0

  • Browser: all

  • Language: all

  • Node (for AoT issues): 6.8.0

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
DzmitryShylovichcommented, Dec 20, 2016
0reactions
angular-automatic-lock-bot[bot]commented, Sep 10, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

DOM updated , however changes not visible in browser
1. Go here: harvesthq.github.io/chosen And find Updating Chosen Dynamically . In short, you need to do: $('.chosen-select').trigger('chosen: ...
Read more >
When DOM Updates Appear to Be Asynchronous
Imagine we have some JavaScript on a page that updates an element's contents and immediately logs those contents out: After loading the page ......
Read more >
How do update item in Dom after server Method changed ...
The List will contain the new values on database level. But I am not able to update/refresh the dropdown list in the Form....
Read more >
Browser.Navigation.pushUrl to come after DOM update #153
One need to clear the password in the DOM before the Browser.Navigation.pushUrl command is executed. Returning a new model with the password ...
Read more >
Rendering Elements - React
Unlike browser DOM elements, React elements are plain objects, and are cheap to create. React DOM takes care of updating the DOM to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found