popup directive implementation