Bug, feature request, or proposal:
[x] - bug
What is the expected behavior?
The generated "id" attribute should be the same in the server rendered html as in the client generated html.
What is the current behavior?
Given:
<mat-form-field>
<input matInput placeholder="Type here">
</mat-form-field>
After building the app for production, on first page load, the input gets an id="mat-input-0" in the server rendered view.
After another page refresh (F5) - the input gets id="mat-input-1". And so on.
Once the app bootstraps client-side, it always gets id="mat-input-0".
Rebuilding the app makes it start from id="mat-input-0" again.
What are the steps to reproduce?
Add MatInputModule and use matInput within a Universal app (can be this starter). Then simply run npm run build:dynamic && npm run serve:dynamic and inspect the server generated html after each refresh.
Note: This only happens if matInput is wrapped in <mat-form-field>.
What is the use-case or motivation for changing an existing behavior?
In order to deal with user input, on a slow connection, one might use preboot in order to record user events (button clicks, typing in an input etc.), things a user might start doing on the server-rendered html, before Angular bootstraps client side, given a slow connection. And replay those events once the client bootstraps. For inputs at least, preboot uses the id attribute to replay user events. Having a different id from server state to client state, breaks preboot.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular: 5.0.0-rc.2
Material: 2.0.0-beta.12
Preboot: 5.1.4
EDIT:
Still happens with the latest: Angular 5.2.4, Material 5.2.0 and Preboot 6.0.0-beta.1 (decided to mention after having just checked, in case anyone's wondering if this is still an issue)
Bug, feature request, or proposal:
[x] - bug
What is the expected behavior?
The generated "id" attribute should be the same in the server rendered html as in the client generated html.
What is the current behavior?
Given:
After building the app for production, on first page load, the input gets an
id="mat-input-0"in the server rendered view.After another page refresh (F5) - the input gets
id="mat-input-1". And so on.Once the app bootstraps client-side, it always gets
id="mat-input-0".Rebuilding the app makes it start from
id="mat-input-0"again.What are the steps to reproduce?
Add MatInputModule and use
matInputwithin a Universal app (can be this starter). Then simply runnpm run build:dynamic && npm run serve:dynamicand inspect the server generated html after each refresh.Note: This only happens if
matInputis wrapped in<mat-form-field>.What is the use-case or motivation for changing an existing behavior?
In order to deal with user input, on a slow connection, one might use preboot in order to record user events (button clicks, typing in an input etc.), things a user might start doing on the server-rendered html, before Angular bootstraps client side, given a slow connection. And replay those events once the client bootstraps. For inputs at least, preboot uses the
idattribute to replay user events. Having a differentidfrom server state to client state, breaks preboot.Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular: 5.0.0-rc.2
Material: 2.0.0-beta.12
Preboot: 5.1.4
EDIT:
Still happens with the latest: Angular 5.2.4, Material 5.2.0 and Preboot 6.0.0-beta.1 (decided to mention after having just checked, in case anyone's wondering if this is still an issue)