diff options
author | crupest <crupest@outlook.com> | 2019-02-25 00:40:27 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-02-25 00:40:27 +0800 |
commit | ad16dbe268984d639c4924fb8bb1e69e68c0fef7 (patch) | |
tree | 545c805dbd163da10845dfc352a4b3fe8e5ec01b /Timeline/ClientApp/src/app/todo-list-page/todo-list-page.component.ts | |
parent | 5e3896fee6b0d376cb7c3f1927596a8ed00e40e4 (diff) | |
download | timeline-ad16dbe268984d639c4924fb8bb1e69e68c0fef7.tar.gz timeline-ad16dbe268984d639c4924fb8bb1e69e68c0fef7.tar.bz2 timeline-ad16dbe268984d639c4924fb8bb1e69e68c0fef7.zip |
Add entrance animation of todo item.
Diffstat (limited to 'Timeline/ClientApp/src/app/todo-list-page/todo-list-page.component.ts')
-rw-r--r-- | Timeline/ClientApp/src/app/todo-list-page/todo-list-page.component.ts | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/Timeline/ClientApp/src/app/todo-list-page/todo-list-page.component.ts b/Timeline/ClientApp/src/app/todo-list-page/todo-list-page.component.ts index e58cca7d..b04d1300 100644 --- a/Timeline/ClientApp/src/app/todo-list-page/todo-list-page.component.ts +++ b/Timeline/ClientApp/src/app/todo-list-page/todo-list-page.component.ts @@ -1,19 +1,36 @@ import { Component, OnInit } from '@angular/core'; import { TodoListService, WorkItem } from './todo-list.service'; +import { trigger, transition, style, animate } from '@angular/animations'; @Component({ selector: 'app-todo-list-page', templateUrl: './todo-list-page.component.html', - styleUrls: ['./todo-list-page.component.css', './todo-list-color-block.css'] + styleUrls: ['./todo-list-page.component.css', './todo-list-color-block.css'], + animations: [ + trigger('itemEnter', [ + transition(':enter', [ + style({ + transform: 'translateX(-100%) translateX(-20px)' + }), + animate('400ms ease-out', style({ + transform: 'none' + })) + ]) + ]) + ] }) export class TodoListPageComponent implements OnInit { - items: WorkItem[]; + items: WorkItem[] = []; + isLoadCompleted = false; constructor(private todoService: TodoListService) { } ngOnInit() { - this.todoService.getWorkItemList().subscribe(result => this.items = result); + this.todoService.getWorkItemList().subscribe({ + next: result => this.items.push(result), + complete: () => { this.isLoadCompleted = true; } + }); } } |