1

と呼ばれるディレクティブがあります。step-fieldディレクティブのテンプレートには、場合によっては max-length または ng-required または のようなカスタム ディレクティブが必要な input または select 要素がありますvalidate-username

ステップ フィールドは次のようになります。

<step-field parent="Admin" field="Username"></step-field>

このディレクティブに「validate-username」と「required=true」を追加したいので、このようになります

<step-field parent="Admin" field="Username" validate-username required="true"></step-field>

そして、ディレクティブ テンプレートの内部で、validate-username が必要であり、入力フィールドに渡す必要があります。(ところで $scope.isRequired = attrs.required)

<div class="field">
    <label> {{fieldName}}:</label>
    <input
            name="{{inputName}}"
            ng-model="wizard[modelName][fieldNameCamel]"
            ng-required="{{isRequired}}"
            type="{{inputType}}"/>
    <div class="field--required" ng-if="isRequired===true"> * </div>
    <div class="ng-messages__wrap"
         ng-show="wizardForm[step][inputName].$dirty || wizardSubmittedOnce">
        <div ng-messages="wizardForm[step][inputName].$error"
             ng-messages-include="/templates/error-messages.html"></div>
    </div>
</div>

step-field に渡すディレクティブの一部をテンプレートの入力フィールドに適用するにはどうすればよいですか?

ありがとう!

4

0 に答える 0