gpt4 book ai didi

asp.net-mvc - ASP.NET MVC 以小写形式呈现 html 标签和属性

转载 作者:太空狗 更新时间:2023-10-29 17:03:29 25 4
gpt4 key购买 nike

似乎 Asp.net MVC Core 和 Asp.net MVC 5.x 都以小写形式呈现 html 标签和属性,这种行为会破坏 Angular 绑定(bind)。举个例子:在我的view.cshtml我用驼峰式大小写绑定(bind)定义了 Angular 组件:

<my-component [fooBar]="foo"></my-component>

稍后呈现为:

<my-component [foobar]="foo"></my-component>

就 Angular 绑定(bind)区分大小写而言,输入属性 fooBar内部组件仍然是 undefined .有什么方法可以覆盖此呈现行为并按原样呈现 html 吗?

最佳答案

当我将其放入 cshtml 文件中时:

<test-tag [testingThisThing]="123" anotherThingTEST="abc"></test-tag>

我在 HTML 源代码中得到的完全相同。您确定元素在加载后没有被修改吗?您在查看“查看源代码”(而不是“检查元素”)吗?

也就是说,我的 test-tag在任何地方都没有被定义为任何东西——你是在使用 Tag Helpers 还是什么? MVC 本身不会将所有属性都小写。

关于asp.net-mvc - ASP.NET MVC 以小写形式呈现 html 标签和属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51553547/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com