ngTransclude初めて、カスタムディレクティブを作成しようとしました。フローティングラベル機能を達成するために、Floating label pattern — Angular JSが動作します。ここで ngTranscludeディレクティブが機能しない、どこが間違っているのかわからない
は私の指示コードです:.directive('floatingLabel', function() {
return {
restrict: 'A',
scope: {
label: '@',
value: '='
},
transclude: true,
templateUrl: 'floating-label-template.html'
}}
)
指令のテンプレート:私のコードで
<input floating-label label="Floating" value="floatingDirective" type="text" class="form-control" ng-model="floatingDirective"/>
Plunker:私は次のようにそれを使用しようとしている
<div class="field">
<label ng-show="value" class="show-hide">{{label}}</label>
<div ng-transclude></div>
</div>
:https://plnkr.co/edit/MC8G4H3B9zEleaBZ7ijJ?p=preview
P.S.私はAngularJSを使います。1.4.9