Created a delegate service for the select modal so we can reset, show programatically#84
Created a delegate service for the select modal so we can reset, show programatically#84sn0opr wants to merge 1 commit intoinmagik:masterfrom
Conversation
…w, etc... programatically
|
hey @sn0opr , I like very much this delegate-service pattern used in ionic to manipulate directives scopes from outside, it's a great idea to apply it to the modal select directive. The difference I see by looking at your code is that elsewhere in ionic delegate services, you do not need to specify a delegate-handle (this is often useful if you have only one instance of your directive in the current template or if you want to call the same method on all instances). Anyway, your implementation looks good to me, let me give it a quick try (we don't have programmatic tests, can you help on #26 ?) and I'm going to merge your commit. best regards |
|
@bianchimro thank you for your consideration, I've never made automatic tests for JS but this is a good occasion to learn how to make tests, but it may take some additional time for me. |
|
@sn0opr if you could help adding some automated test in the repo that would be great. Testing this kind of project is quite difficult in my opinion as we have to test interface components (so we must describe what we expect to see) and we rely on existing services that we have to mock ($ionicModal in this case, but probably other ionic and angular components as well). let's keep in touch about this if you want to give it a try! |
|
hi @sn0opr, seems like merging previous PRs creates a conflict with your code. Mauro |
The problem that I faced is that I have a reset button on my form, but when I reset my select options model in my controller , the items stay selected in the select modal, because the
isCheckedobject is not updated.I used the same idea of ionic delegate service for their directives like the
<ion-list>etc, this service will allow us to reset the selected options programatically or show the select modal, we may also add other methods in the future...###Usage:
you should add handler-id attribute, an ID that we will use in our controller:
In our controller, we inject the
modalSelectDelegateservice, then we get our select modal handler by using the getHandler method: