Skip to content

Instantly share code, notes, and snippets.

@IAfanasov
Created October 22, 2020 07:05
Show Gist options
  • Save IAfanasov/0d4023af7a591b7f2896ef6731b6c640 to your computer and use it in GitHub Desktop.
Save IAfanasov/0d4023af7a591b7f2896ef6731b6c640 to your computer and use it in GitHub Desktop.
@Component({
selector: 'app-dummy-component',
templateUrl: './dummy-component.component.html',
})
export class DummyComponent implements OnInit {
constructor(public route: ActivatedRoute) {
}
ngOnInit(): void {
this.route.queryParams
.pipe(
map(qs => qs[QueryParamNames.id]),
distinctUntilChanged(),
tap(id => {
if (id) {
// load the item and show the edit form
} else {
// load the creation form
}
}),
)
.subscribe();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment