0
리팩토링하고 싶은 ng-switch 문이 있습니다. 그것은 다음과 같습니다공유 옵션이있는 ng-switch
<div ng-switch on="property.type">
<input type="text" ng-switch-when="string" ng-model="property.value" placeholder="Property value">
<select ng-switch-when="bool" ng-model="property.value" ng-options="value for value in [true,false]" placeholder="Property value"></select>
<input type="number" ng-switch-when="int" ng-model="property.value" placeholder="Property value">
<input type="text" ng-switch-default ng-model="property.value" placeholder="Property value">
</div>
당신은 ng-model
및 placeholder
옵션은 모든 경우에 동일하다는 것을 알 수 있습니다. 내 질문은 : 나는 어떻게 든이 옵션을 한 번만 작성하도록 리펙토링 할 수 있습니까?
감사합니다. 완전히 모든 중복을 피하기 위해 리팩토링하지 않지만 열린