refactor dropdown directive