Added logic in angular to manage the reassignment of files