Html标签属性缩进最佳做法?(Html tag attributes indentation best practices?)
我想对你在转义HTML(示例中的自定义角度指令)标签属性以及原因方面的更好做法有所了解。
AFAIK最常用的是:
1.-将间距与第一个属性匹配
<input name="textField" ng-required="column.required" ng-blur="onBlurCallback(data, column)" ng-change="onChangeCallback(data, column)" ng-model="data" class="text-field" ng-disabled="dataCanBeEdited" input-maxlength="{{column.maxLength}}" input-mask="{{ column.maskType }}">
2.-在缩进上添加一个级别
<div> <input name="textField" ng-required="column.required" ng-blur="onBlurCallback(data, column)" ng-change="onChangeCallback(data, column)" ng-model="data" class="text-field" ng-disabled="dataCanBeEdited" input-maxlength="{{column.maxLength}}" input-mask="{{ column.maskType }}"> </div>
虽然我很确定那里有更多的选择......
I would like to have your opinion about what would be a better practice on escaping HTML (a custom angular directive in the example) tag attributes and why.
AFAIK those are the most used:
1.- Match the spacing with the first attribute
<input name="textField" ng-required="column.required" ng-blur="onBlurCallback(data, column)" ng-change="onChangeCallback(data, column)" ng-model="data" class="text-field" ng-disabled="dataCanBeEdited" input-maxlength="{{column.maxLength}}" input-mask="{{ column.maskType }}">
2.- Add one level on the indentation
<div> <input name="textField" ng-required="column.required" ng-blur="onBlurCallback(data, column)" ng-change="onChangeCallback(data, column)" ng-model="data" class="text-field" ng-disabled="dataCanBeEdited" input-maxlength="{{column.maxLength}}" input-mask="{{ column.maskType }}"> </div>
Although I'm pretty sure there are more options around there...
原文:https://stackoverflow.com/questions/46711907
更新时间:2023-06-22 18:06
最满意答案
尝试onclick值的模板格式:
onclick="deleteImage('{%=filename%}');"
尝试file.name
onclick="deleteImage('{%=file.name%}');"
try the template format for onclick value:
onclick="deleteImage('{%=filename%}');"
try file.name as well
onclick="deleteImage('{%=file.name%}');"
相关问答
更多-
尝试: