Added badge at tabBar

This commit is contained in:
Tiago Kayaya
2020-09-08 11:17:07 +01:00
parent 67b6cc24c0
commit e132134ae7
3 changed files with 27 additions and 2 deletions
+2
View File
@@ -2,6 +2,7 @@
<ion-tab-bar slot="bottom">
<ion-tab-button tab="events">
<ion-icon name="home"></ion-icon>
<ion-badge color="danger">{{totalEvent}}</ion-badge>
<ion-label>Home</ion-label>
</ion-tab-button>
@@ -11,6 +12,7 @@
</ion-tab-button>
<ion-tab-button tab="gabinete-digital">
<ion-icon name="file-tray-stacked"></ion-icon>
<ion-badge color="danger">{{totalExpediente}}</ion-badge>
<ion-label>Gabinete Digital</ion-label>
</ion-tab-button>
<!-- <ion-tab-button tab="search">
+21 -1
View File
@@ -1,4 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { EventsService } from '../services/events.service';
import { formatDate } from '@angular/common';
import { Event } from '../models/event.model';
@Component({
selector: 'app-home',
@@ -6,10 +9,27 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./home.page.scss'],
})
export class HomePage implements OnInit {
eventsList: Event[];
totalEvent=0;
totalExpediente=2;
constructor() { }
constructor(private eventService: EventsService) { }
ngOnInit() {
this.eventService.getAllEvents(formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 00:00:00', formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 23:59:59')
.subscribe(response => {
this.eventsList = response;
this.totalEvent = this.eventsList.length;
}
);
}
}
+4 -1
View File
@@ -28,4 +28,7 @@
} */
.span-color{
color:red;
}
}
/* .ion-badge{
background: red;
} */