Rails を使用してアプリを作成しています。angularstrap http://mgcrea.github.io/angular-strap/#/modalでモーダル ボックスをポップアップしようとしましたが、パーシャルでモーダル ボックスを使用する例を示しています。しかし、同じページから div を呼び出したいと思います。 ng-template.しかし、私はそのためのドキュメントを取得しませんでした. これ知ってる人いますか??
4258 次
3 に答える
1
メインの html ページで、TemplageCache を次のように定義します。
<script type="text/ng-template" class="modal" id="/myTmpl.html">
<div class="modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" aria-label="Close" ng-click="$hide()">
<span aria-hidden="true">×</span></button>
<h4 class="modal-title">This title</h4>
</div>
<div class="modal-body">
This is content
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" ng-click="$hide()">Close</button>
</div>
</div>
</div>
</div>
</script>
次にJavaScriptで
$scope.showMyModal=function(){
var myModal = $modal({placement:'center', animation:"am-fade-and-scale", templateUrl:'/myTmpl.html', show: true});
}
于 2015-09-15T01:51:55.253 に答える
0
インライン (javascript の html 文字列) 変数がある場合は、ng-template になります。例えば:
var t = "<div></div>";
t はあなたの ng-template かもしれません。
残念ながら、あなたが探していることを行う方法がわかりません。
于 2013-07-30T21:56:04.187 に答える