[英]Why is Visual Studio Code altering my Angular html?
I have the following segment of code in my Angular html:我的 Angular html 中有以下代码段:
<div class="col">
<input
#changeValue
type="range"
min={{minMaxPrices.minPrice}}
max={{minMaxPrices.maxPrice}}
classname="custom-range w-100"
(change)="handlePriceChange(changeValue.value)"
/>
Within the code is the template variable #changeValue.在代码中是模板变量#changeValue。 But whenever I save the code in in Visual Studio Code the template variable, #changeValue is automatically assigned to itself like so: #changeValue="#changeValue" as shown below.
但是,每当我将代码保存在 Visual Studio Code 中的模板变量中时,#changeValue 就会自动分配给自身,如下所示:#changeValue="#changeValue"。
<div class="col">
<input
#changeValue="#changeValue"
type="range"
min={{minMaxPrices.minPrice}}
max={{minMaxPrices.maxPrice}}
classname="custom-range w-100"
(change)="handlePriceChange(changeValue.value)"
/>
And this breaks my code.这破坏了我的代码。 How can I stop this from happening?
我怎样才能阻止这种情况发生?
Do you have any VS Code extensions for auto-code formatting enabled?您是否启用了任何用于自动代码格式化的 VS Code 扩展? That could be the cause.
这可能是原因。
To disable auto-format, you can add "editor.formatOnSave": false
to your settings file .要禁用自动格式化,您可以将
"editor.formatOnSave": false
添加到您的设置文件中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.