split by words
This commit is contained in:
parent
3e42d44e83
commit
66216075e7
@ -65,7 +65,7 @@
|
|||||||
<div class="person-info">
|
<div class="person-info">
|
||||||
<div class="image">
|
<div class="image">
|
||||||
<div class="image-wrapper">
|
<div class="image-wrapper">
|
||||||
<img src="{{ person.image.small }}" alt="{{ person.image.alt }}" title="{{ person.image.title }}">
|
<img src="{{ person.images[0].medium }}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="detail">
|
<div class="detail">
|
||||||
|
@ -69,7 +69,12 @@ export class ListComponent implements OnInit {
|
|||||||
|
|
||||||
public getPersonDetail(person: IPerson): string {
|
public getPersonDetail(person: IPerson): string {
|
||||||
const str = person.intro.replace(/<.*?>/g, '');
|
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 {
|
private getList(): void {
|
||||||
|
@ -6,7 +6,7 @@ export interface IPerson {
|
|||||||
personal_code: number;
|
personal_code: number;
|
||||||
dob: string;
|
dob: string;
|
||||||
phone: string;
|
phone: string;
|
||||||
image: string[];
|
images: any;
|
||||||
intro: string;
|
intro: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user