0
モーダルコントローラーで私は this.cancel = function()....を使用しようとしていましたが、関数が呼び出されませんでした。 私はそれを$ scope.cancelに変更しなければなりませんでした。それが機能するには、なぜそれが正しいのかを理解しようとしています。
このメインコントローラ
コードでの作業は、スニペットない "何でも":
function MainController($uibModal) {
//this works
this.popup = function() {
$uibModal.open({
controller: 'PopupCtrl',
templateUrl: 'myctrl.html'
});
};
}
function PopupController($scope, $uibModalInstance) {
//"this.cancel" does not work, need to use $scope
$scope.cancel = function(){
$uibModalInstance.dismiss();
};
//"this" wont work
this.ok = function(){
$uibModalInstance.dismiss();
};
}
私はフォーク例に
http://plnkr.co/edit/nMBe6SqXzicxkHNT5JdT
素晴らしい!ご協力いただきありがとうございます – VladimirSD