0
問題があり、理由はわかりません。なぜなら、ローカルサーバーでは動作しますが、プロダクションでは動作しないからです。ディレクティブのモーダルダイアログを閉じる
私はこのようなディレクティブがあります、
だから、<modal-dialog show='modalShown' types="types">
:私は休閑として持っている私のコントローラで
calcP.directive('modalDialog', function() {
return {
restrict: 'E',
scope: {
show: '=',
types: '=',
},
replace: true,
transclude: true,
link: function(scope, element, attrs) {
console.log('scope', scope);
scope.dialogStyle = {};
if (attrs.width)
scope.dialogStyle.width = attrs.width;
if (attrs.height)
scope.dialogStyle.height = attrs.height;
scope.hideModal = function() {
scope.show = false;
delete scope.types.individual;
};
},
template: "<div class='ng-modal' ng-show='show'><div class='ng-modal-overlay' ng-click='hideModal()'></div><div class='ng-modal-dialog' ng-style='dialogStyle'><div class='ng-modal-close' ng-click='hideModal()'>X</div><div class='ng-modal-dialog-content' ng-transclude></div></div></div>"
};
});
:私は休閑として持っているビューで
$scope.modalShown = false;
$scope.toggleModal = function() {
$scope.modalShown = !$scope.modalShown;
console.log('modalShown', $scope.modalShown);
};
をconsole.logを使ってみる限り、toggleModal()は機能しません。
のように$スコープに割り当て$スコープ
試しに割り当てる残念ながら、あなたのソリューションが動作しません。.. –