refactor: select client, set tab title
MODIFY
src/app/components/marketplace-client-app/marketplace-client-app.component.ts
src/app/components/marketplace-client-app/marketplace-client-app.component.ts
@@ -81,6 +81,11 @@ export class MarketplaceClientAppComponent implements OnInit {
// https://material.angular.io/components/table/examples
const filterValue = (event.target as HTMLInputElement).value;
this.dataSource.filter = filterValue.trim().toLowerCase();
+
+ // if only one client is left we select it
+ if (this.dataSource.filteredData.length === 1) {
+ this.selectClient(this.dataSource.filteredData[0]);
+ }
}
/**

MODIFY
src/app/services/hero/hero.service.ts
src/app/services/hero/hero.service.ts
import { EventEmitter, Injectable } from '@angular/core';
import { ConfigService } from '../config/config.service';
import { IHero } from '../../interfaces/IConfig';
+import {Title} from '@angular/platform-browser';
@Injectable({
providedIn: 'root',
@@ -9,13 +10,14 @@ export class HeroService {
hero!: IHero;
heroChanged: EventEmitter<IHero> = new EventEmitter<IHero>();
- constructor(private configService: ConfigService) {
+ constructor(private configService: ConfigService, private titleService: Title) {
this.hero = configService.getHero();
}
setUpHero(hero: IHero | any): void {
this.hero.large = hero.large ? true : false;
this.hero.title = this.checkTitle(hero.title) ? hero.title : '';
+ this.titleService.setTitle(this.hero.title);
this.hero.subtitle = this.checkTitle(hero.subtitle) ? hero.subtitle : '';
this.heroChanged.emit(hero);

MODIFY
src/index.html
src/index.html
<html lang="en">
<head>
<meta charset="utf-8" />
- <title>DevPortal2</title>
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />

refactor: select client, set tab title