// Avoid watching for changes until after ngOnInit is complete
// so we don't grab the same copy twice.
this.route.paramMap.subscribe((params: ParamMap) => {
- this.tab = params.get('tab') || 'summary';
+ this.tab = params.get('tab');
const id = +params.get('id');
- if (id && id !== this.currentItemId) {
- this.currentItemId = id;
- this.getItemById(id);
+ if (id) {
+ if (!this.tab) { this.tab = 'summary'; }
+
+ if (id !== this.currentItemId) {
+ this.currentItemId = id;
+ this.getItemById(id);
+ }
+ } else if (!this.tab) {
+ this.tab = 'list';
}
});
});