No
You don’t need to unsubscribe as the observable itself completes.You can verify the same by adding a finalize block to see whether observable completes itself or not.
import { finalize } from "rxjs/operators";
dialogRef
.afterClosed()
.pipe(finalize(() => console.log("completed")))
.subscribe(data => {
console.log(data);
});
And when you will close the dialog, you will see completed in console, this depicts that you do not need to unsubscribe the observable.