dwmkerr / angular-modal-service

Modal service for AngularJS - supports creating popups and modals via a service.
MIT License
626 stars 321 forks source link

Add support for component-based modals #266

Closed DougKeller closed 5 years ago

DougKeller commented 5 years ago

Our team is preparing for our transition from AngularJS to Angular X. As part of this process, we've begun componentizing as many things as we can.

AngularModalService does not support AngularJS 1.5.x+ components. This PR aims to change that.

New modal options:

I've added tests, documentation, and comments describing this change. It will not have an effect on any existing usage of this ModalService.

Example usage:

ModalService.showModal({
  component: 'myComponent',
  bindings: {
    name: 'Foo',
    myRecord: { id: '123' }
  }
});

This will display a new modal with myComponent as the template and all values specified by the bindings option will be forwarded the the rendered component.

codecov[bot] commented 5 years ago

Codecov Report

Merging #266 into master will increase coverage by 2.31%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #266      +/-   ##
==========================================
+ Coverage   86.23%   88.54%   +2.31%     
==========================================
  Files           1        1              
  Lines         109      131      +22     
==========================================
+ Hits           94      116      +22     
  Misses         15       15
Impacted Files Coverage Δ
src/angular-modal-service.js 88.54% <100%> (+2.31%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2879036...8743343. Read the comment docs.

dwmkerr commented 5 years ago

This is excellent @DougKeller - I can't wait to get this working with Angular X. I'm cloning the PR locally and running some tests, will get back to you soon!

DougKeller commented 5 years ago

Glad you like it! Just to clarify, I'm not sure that this will work with Angular X components, however it allows existing AngularJS modals to use AngularJS 1.5.x components rather than controllers, which will hopefully make it easier to switch to some sort of component-based Angular X modal service in the future.

dwmkerr commented 5 years ago

Sorry for the delay Doug - it's in, it's published, thanks so much for your contributions!