Universal: HTML page rendered from server still have angular attributes present and w3c validation failure

Created on 19 May 2017  路  12Comments  路  Source: angular/universal

Note: for support questions, please use one of these channels: https://github.com/angular/universal/blob/master/CONTRIBUTING.md#question. This repository's issues are reserved for feature requests and bug reports. Also, Preboot has moved to https://github.com/angular/preboot - please make preboot-related issues there.

  • I'm submitting a ...
  • [X ] bug report
  • [ ] feature request
  • [ ] support request => Please do not submit support request here, see note at the top of this template.

  • What modules are related to this Issue?

  • [ X] express-engine
  • [ ] aspnetcore-engine

  • Do you want to request a feature or report a bug?
    Report a Bug

  • What is the current behavior?
    In Angular generally when we enable enableprodmode() most of the angular related atributes sucha as routerlink, routerlinkactive etc removed and it helps to make it w3c valid html page. But in this case even I have added enableprodmode still the pages render from server with those tags and w3c giving errors on those attriibutes.

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem by creating a github repo.

  • What is the expected behavior?
    Expected behavior should be when enableprodmode activated the page should not have angular related attributes which not validated by w3c

  • What is the motivation / use case for changing the behavior?

  • Please tell us about your environment:

  • Angular version: 4.X

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX ] All
  • Language: [all | TypeScript X.X | ES6/7 | ES5 ] All
  • OS: [all | Mac OS X | Windows | Linux ] All
  • Platform: [all | NodeJs | Java | PHP | .NETCore | Ruby] NodeJS

  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)

repro steps

All 12 comments

this is more angular core related than universal I'd believe

@samvloeberghs but without universal if I enable prodmode then its working as expected.

@kalyan11021980 @kalyan1102 Just wondering, how can you know that? You don't have any HTML statically loaded if you use Angular only on the browser side. Do you export the loaded dom from chrome inspector or something? It's been a while since I really checked validity against W3C validator .. Browsers are so forgiving these days

@samvloeberghs yes so without angular universal if I just enable pordmode and then take a copy of the rendered DOM from inspect its working fine and validated in w3c

The rendered DOM from inspect is probably not very representative to use as a check in the W3C validator as it is Chrome fixing given errors etc, even from Angular browser rendered code..

@samvloeberghs this idea provided by angular team only. I had raised an defect for that and they told that if I enable prod mode then all the code should w3c validated.

The best way to verify the HTML itself is probably to do a curl and then copy/paste the response body to validate, or look at the network responses for the raw HTML document.

@wesleycho I have done same as well. But many things which generated like _ngcontent-c1="" , routerlink, routerlinkactive etc is invalid code for w3c

Is this still an issue on the latest versions? (Angular v5)
If so can you provide a repro

Closing as gone stale, please open another issue if you still have a problem

Hi, @kalyan1102 I am still facing the same issue W3 validator is not allowing any _ngcontent as attribute. Did you get any solution to fix it?

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._

Was this page helpful?
0 / 5 - 0 ratings