Fix placeholder bug and improve code quality
This commit is contained in:
@@ -28,7 +28,8 @@ export class HelperService {
|
||||
return shares;
|
||||
}
|
||||
|
||||
formatKeywordsData(keywords: Keyword[]) {
|
||||
formatKeywordsData(): Keyword[] {
|
||||
var keywords: Keyword[] = [];
|
||||
this.botService.getKeywords().subscribe((result) => {
|
||||
var data = JSON.parse(result);
|
||||
for (let i = 0; i < data.data.length; i++) {
|
||||
|
@@ -44,7 +44,7 @@
|
||||
</button>
|
||||
</mat-chip>
|
||||
<input
|
||||
placeholder="New fruit..."
|
||||
placeholder="New share..."
|
||||
[matChipInputFor]="sharesList"
|
||||
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"
|
||||
[matChipInputAddOnBlur]="addOnBlur"
|
||||
|
@@ -29,7 +29,7 @@ export class BotSettingsComponent implements OnInit {
|
||||
|
||||
ngOnInit(): void {
|
||||
this.shares = this.helper.formatShareData();
|
||||
this.helper.formatKeywordsData(this.keywords);
|
||||
this.keywords = this.helper.formatKeywordsData();
|
||||
}
|
||||
|
||||
addOnBlur = true;
|
||||
@@ -52,7 +52,7 @@ export class BotSettingsComponent implements OnInit {
|
||||
if (value) {
|
||||
await this.helper.delay(1000);
|
||||
this.keywords = [];
|
||||
this.keywords = this.helper.formatKeywordsData(this.keywords);
|
||||
this.keywords = this.helper.formatKeywordsData();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ export class BotSettingsComponent implements OnInit {
|
||||
await this.helper.delay(1000);
|
||||
|
||||
this.keywords = [];
|
||||
this.keywords = this.helper.formatKeywordsData(this.keywords);
|
||||
this.keywords = this.helper.formatKeywordsData();
|
||||
}
|
||||
|
||||
async addShare(event: MatChipInputEvent): Promise<void> {
|
||||
|
Reference in New Issue
Block a user