refactor popup with angular