Created
October 22, 2020 07:05
-
-
Save IAfanasov/0d4023af7a591b7f2896ef6731b6c640 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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