0

ポップオーバー機能を備えたディレクティブを作成しようとしています。私のテンプレートは最短のものではないので、それを使用することにしtemplateUrlました。次に、ポップオーバーにテンプレートを使用することにしたのでng-template、ディレクティブ テンプレート ファイル内で定義を使用し、それを で使用しようとしましpopover-templateたが、ツールチップが表示されません。次に例を示します。

<script type="text/ng-template" id="myTemplate.html">
    {{label}}
</script>

<div ng-if='label.length >= 5' popover-template='myTemplate.html' popover-trigger='mouseenter'>
    {{label | limitTo: 5}}{{label.length >= limit ? '..' : ''}}
</div>
<div ng-if='label.length < 5'>
    {{label}}
</div>

なぜそれができないのですか?それを行う主な理由は、(もちろん) クリーンでエレガントな状態に保ちたいためであり、ポップオーバーにスタイリングを適用したいからです。

更新: ディレクティブを追加しましたが、その動作と画像を完成させるためだけです。

angular.module('MyApp')
    .directive('myDirective', function() {
        return {
            restrict: 'E',
            scope: {
                label: '@'
            },
            templateUrl: 'my-directive.html'
        };
    });
4

0 に答える 0