From 3f5cd08b8e76c44bd8919b7b6ca5dc9a046efad1 Mon Sep 17 00:00:00 2001 From: ztimson Date: Sat, 31 Aug 2019 00:35:23 -0400 Subject: [PATCH] Custom map codes! --- src/app/views/home/home.component.html | 5 +++-- src/app/views/home/home.component.ts | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/app/views/home/home.component.html b/src/app/views/home/home.component.html index eaf9b39..317f7db 100644 --- a/src/app/views/home/home.component.html +++ b/src/app/views/home/home.component.html @@ -8,10 +8,11 @@
- +
- +
+ Codes can only be made up of letters and numbers!
diff --git a/src/app/views/home/home.component.ts b/src/app/views/home/home.component.ts index 4550be7..406dc1c 100644 --- a/src/app/views/home/home.component.ts +++ b/src/app/views/home/home.component.ts @@ -11,6 +11,7 @@ const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; }) export class HomeComponent { code: string = ''; + valid = false; constructor(private syncService: SyncService, private router: Router) { } @@ -21,4 +22,8 @@ export class HomeComponent { } while (await this.syncService.exists(mapCode)); return this.router.navigate(['/', mapCode]); } + + isValid() { + this.valid = !this.code.split('').filter(c => chars.indexOf(c) == -1).length + } }