Copying and pasting a function is not a good idea. We should consider making a ModalService that takes care of the viewing and calls to S3 and then inject it into both directives that need modal stuff.