This is because *ngIf="selectedId() is evaluated as FALSE when value is 0: https://developer.mozilla.org/en-US/docs/Glossary/Falsy
Something like:
<div *ngIf="selectedId()?.toString() as id">Current id: {{ id }}</div>
should do the trick. If you id is null, this will not show anything, but if is 0, it will be evaluate as true as this is a string.