Im wondering what is the correct approach about software design & best practice for angularjs modals. In my application I have the main window which is using its own controller, and there I have a show(), hide() & destroy functions for the modal. a button on my main window will show() the modal, there I'll have an isolate scope with variables inherited from parent scope, and its own controller. I'd want to be able to pass an object to the dialog, in order to do a "modify" operation on it, and a "Create" button which closes the modal and creates a new object of the data entered in the modal.
Im facing two issues: 1. Inability to transfer the object from the scope in my main controller and the one in my modal controller, unless having 1 controller with a predefined object, and then I can add data to it (But why it works?) 2. Inconsistency with show(),hide(): The show() Would have to reside in the main controller, but since the modal has a controller of its own, it will have to implement the hide() & destroy(), which feels very bad to me in terms of code responsibility.
What is a good practice in such situations?