これは、表示するModalポップアップのコードです。私はコントローラの内部に関数を挿入する必要があります。ここでモーダルポップアップコントローラ内の関数を渡す方法。角モーダルサービスモーダルポップアップ内で関数を書く方法。 Orelse Modalのポップアップ内で新しいコントローラー機能を渡す方法
scope.show = function(ChartData) {
ModalService.showModal({
templateUrl: "scaleRecipePopUp.html",
controller:function(){
// Here i have to pass the function.
}
}).then(function(modal) {
modal.element.modal();
modal.close.then(function(result) {
scope.message = "You said " + result;
});
});
}
これは、モーダルポップアップの内側に渡さなければならない機能です。コントローラの代わりに。 Apply manual関数は、サービスで記述された関数名です。別のコントローラの中で呼び出さなければなりません。他の解決策を提案してください。
this.applyManualScale = function(){
if(scope.isAutoScale){
scope.max[scope.idNum] = null;
scope.min[scope.idNum] = null;
scope.isAutoScaleArr[scope.idNum] = true;
scope.plotDataSeries();
$('#scaleModal').modal('hide');
}
else if(scope.maxVal!=null && scope.minVal!=null){
scope.max[scope.idNum] = scope.maxVal;
scope.min[scope.idNum] = scope.minVal;
scope.isAutoScaleArr[scope.idNum] = false;
scope.plotDataSeries();
$('#scaleModal').modal('hide');
}
};
これはNG-テンプレートとして考えられているこの私のhtmlファイルの私のディレクティブ
.directive('hcarea', function (Data, ModalService) {
return {
restrict: 'E',
templateUrl: "../page/trendChart.html",
scope: {
options: '='
},
link: function (scope, element) {
var chart;
scope.show = function() {
ModalService.showModal({
templateUrl: "scalePopUp.html",
controller:function(){
}
}).then(function(modal) {
modal.element.modal();
modal.close.then(function(result) {
scope.message = "You said " + result;
});
});
};
}
}
}
です。
<script type="text/ng-template" id="modal.html">
<div class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" ng-click="close('Cancel')" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Yes or No?</h4>
</div>
<div class="modal-body">
<p>It's your call...</p>
<p>Fry lives in {{futurama.city}}</p>
</div>
<div class="modal-footer">
<button type="button" ng-click="close('No')" class="btn btn-default" data-dismiss="modal">No</button>
<button type="button" ng-click="close('Yes')" class="btn btn-primary" data-dismiss="modal">Yes</button>
</div>
</div>
</div>
</div>
</script>
のようになります。次
お使いのコントローラであなたを示唆しています? –
あなたのコントローラー機能も見せてください! – Aravind
angle-uiモーダルポップアップを使用できますか?もしそうなら、[link](https://embed.plnkr.co/6fx26BVrXu0ud8TkvrMq/) –