Skip to content

Commit

Permalink
Wait for scope bindings to be set before initializing component modals.
Browse files Browse the repository at this point in the history
This ensures that component bindings are available in the $onInit callback of the component's lifecycle
This addresses the main issue brought up by dwmkerr#270
  • Loading branch information
DougKeller committed Sep 15, 2020
1 parent 3ddaf86 commit 904c261
Show file tree
Hide file tree
Showing 10 changed files with 125 additions and 25 deletions.
4 changes: 3 additions & 1 deletion README.md
Expand Up @@ -143,7 +143,7 @@ ModalService.showModal({
```


## Support for AngularJS 1.5.x Components
### Support for AngularJS 1.5.x Components

It's also possible to specify a component, rather than a template and controller. This can be done by providing a `component` and an optional `bindings` value to the `showModal` function.

Expand All @@ -157,6 +157,8 @@ ModalService.showModal({
})
```

**Disclaimer:** ModalService supports 1.5.x components by wrapping them in a custom-build template and passing in bindings via the controller's scope. This is not a perfect implementation, and is only intended to adhere to AngularJS best practices by avoiding controller/view flows.
As such, attribute (@) and output (&) bindings will not work correctly. Instead of defining an output binding, a function can be provided to the component via a 1-way binding (<).

### ShowModal Options

Expand Down
4 changes: 2 additions & 2 deletions dst/angular-modal-service.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dst/angular-modal-service.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dst/angular-modal-service.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 904c261

Please sign in to comment.