admin管理员组文章数量:1245032
I have a project where I'm using AngularJS, but one of the requirements is that my app must pass official HTML5 and CSS3 validation.
Why are apps built with AngularJS not passing official W3C HTML5 validation? I really like AngularJS, so what should I do? Do I really have to build it from scratch or is there any reasonable article/blog which address this issue so I can explain it to my professor?
I have a project where I'm using AngularJS, but one of the requirements is that my app must pass official HTML5 and CSS3 validation.
Why are apps built with AngularJS not passing official W3C HTML5 validation? I really like AngularJS, so what should I do? Do I really have to build it from scratch or is there any reasonable article/blog which address this issue so I can explain it to my professor?
Share Improve this question edited Jul 31, 2023 at 19:44 TylerH 21.1k77 gold badges79 silver badges112 bronze badges asked Apr 2, 2013 at 14:52 user1127302user1127302 2- "Why are apps built with AngularJS not passing official W3C HTML5 validation" Who says they aren't? Please add a minimal reproducible example of your AngularJS code that fails W3C validation, including the error message your code generates. – TylerH Commented Jul 31, 2023 at 19:45
- I would first question the requirement – aakoch Commented Jul 31, 2023 at 20:06
2 Answers
Reset to default 12According to some other Stackoverflow QA you can pre-fix your angularjs attributes with the data-
attribute.
So ng-app
would bee data-ng-app
. This would mean that your markup is valid html5 and still work with angularjs.
See these questions for reference.
AngularJS tags attributes
Can I use another prefix instead of `ng` with angularjs?
It is very late to this answer, but I wrote a basic tool called angular-html5 which will convert directives to data-directives
automatically. There are also grunt and gulp plugins to be used in build steps.
That way you can still write:
<div ng-if="whatever"></div>
And it will turn into:
<div data-ng-if="whatever"></div>
Just add it to your workflow, and you can use it similarly to using ng-min for minification.
See Angular Directives Normalization Rules for further information.
本文标签: javascriptAngularJS app not passing official W3C HTML5 validationStack Overflow
版权声明:本文标题:javascript - AngularJS app not passing official W3C HTML5 validation - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1740243529a2247812.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论