diff --git a/src/app/list/list.component.html b/src/app/list/list.component.html index a639a47..de16405 100644 --- a/src/app/list/list.component.html +++ b/src/app/list/list.component.html @@ -65,7 +65,7 @@
- {{ person.image.alt }} +
diff --git a/src/app/list/list.component.ts b/src/app/list/list.component.ts index 35faa91..2d574ce 100644 --- a/src/app/list/list.component.ts +++ b/src/app/list/list.component.ts @@ -69,7 +69,12 @@ export class ListComponent implements OnInit { public getPersonDetail(person: IPerson): string { const str = person.intro.replace(/<.*?>/g, ''); - return (person.intro.length > 284) ? (str.substring(0, 284)) + '....' : (person.intro); + let words = str.split(' '); + if (words.length >= 38) { + words = words.slice(0, 37); + words[words.length - 1] += '...'; + } + return words.join(' '); } private getList(): void { diff --git a/src/app/person.ts b/src/app/person.ts index 5559804..62b314d 100644 --- a/src/app/person.ts +++ b/src/app/person.ts @@ -6,7 +6,7 @@ export interface IPerson { personal_code: number; dob: string; phone: string; - image: string[]; + images: any; intro: string; }