Skip to content

Commit 3299d93

Browse files
committed
Fix problem with having to double-click modal button
1 parent 5bb4d87 commit 3299d93

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

angular-schema-form-complex-ui.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ angular.module('schemaForm').directive('modal', function () {
8080
'<div class="{{ form.htmlClass ? form.htmlClass: \'modal-dialog\'}}">' +
8181
'<div class="modal-content">' +
8282
'<div class="modal-header">' +
83-
'<button type="button" class="close" ng-click="controller.toggleModal()" data-dismiss="modal" aria-hidden="true">&times;</button>' +
83+
'<button type="button" class="close" ng-click="parentController.toggleModal()" data-dismiss="modal" aria-hidden="true">&times;</button>' +
8484
'<h4 class="modal-title">{{ form.title }}</h4>' +
8585
'</div>' +
8686
'<div class="{{ form.fieldHtmlClass ? form.fieldHtmlClass: \'modal-body\'}} " ng-transclude></div>' +
@@ -90,7 +90,7 @@ angular.module('schemaForm').directive('modal', function () {
9090
restrict: 'E',
9191
transclude: true,
9292
replace: true,
93-
scope: true,
93+
scope: false,
9494
link: function postLink(scope, element, attrs) {
9595
scope.$watch((attrs).visible, function (value) {
9696
if (value == true)

angular-schema-form-complex-ui.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/angular-schema-form-complex-ui.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ class ComplexUIController {
3636
$broadcast: any;
3737

3838
toggleModal = function () {
39-
// TODO: Fix so one do not have to click extra times to show the modal
4039
this.directiveScope.showModal = !this.directiveScope.showModal;
4140
};
4241

@@ -124,7 +123,7 @@ angular.module('schemaForm').directive('modal', function () {
124123
'<div class="{{ form.htmlClass ? form.htmlClass: \'modal-dialog\'}}">' +
125124
'<div class="modal-content">' +
126125
'<div class="modal-header">' +
127-
'<button type="button" class="close" ng-click="controller.toggleModal()" data-dismiss="modal" aria-hidden="true">&times;</button>' +
126+
'<button type="button" class="close" ng-click="parentController.toggleModal()" data-dismiss="modal" aria-hidden="true">&times;</button>' +
128127
'<h4 class="modal-title">{{ form.title }}</h4>' +
129128
'</div>' +
130129
'<div class="{{ form.fieldHtmlClass ? form.fieldHtmlClass: \'modal-body\'}} " ng-transclude></div>' +
@@ -134,7 +133,7 @@ angular.module('schemaForm').directive('modal', function () {
134133
restrict: 'E',
135134
transclude: true,
136135
replace: true,
137-
scope: true,
136+
scope: false,
138137
link: function postLink(scope: modalScope, element: JQuery, attrs: ng.IAttributes) {
139138

140139

0 commit comments

Comments
 (0)