角に新しく、ちょうどZurb Foundation 4との調和を図ろうとしています。私はhttp://foundation.zurb.com/docs/components/reveal.htmlコンポーネントを利用しようとしています。ラッピングファンデーション4が角に現れます
:これはポイントまで正常に動作しますdirective('modal', function() {
return {
template: '<div ng-transclude id="notice" class="reveal-modal">' +
'<a close-modal></a>' +
'</div>',
restrict: 'E',
transclude: true,
replace: true,
scope: {
'done': '@',
},
transclude: true,
link: function(SCOPE, element, attrs, ctrl) {
SCOPE.$watch('done', function (a) {
// close-modal
});
}
}
}).
directive('closeModal', function() {
return {
template: '<a ng-transclude href="#" class="close-reveal-modal">x</a>',
restrict: 'A',
transclude: true,
replace: true
}
}).
directive('showModal', function() {
return {
template: '<a ng-transclude class="reveal-link" data-reveal-id="notice" href="#"></a>',
restrict: 'A',
transclude: true,
replace: true,
}
});
、例えば、私はテンプレートから別の通知を表示するモーダルを使用することができます。
ストレートなアプローチは、ディレクティブとしてラップするように見えました
しかし、粘着性があるのはコントローラ/特定のイベント(例えば$watch
内)でクローズド・モーダル/ショー・モーダルをトリガーしたい場合です。私は私の指示がクリックを誘発するコントローラを必要としていると仮定していますが、良い角度の練習ですか?
fiddle/plnkrを追加できますか? – GFoley83