I am encountering this error in my ts.file
, as I delve into the world of Angular/Ionic. Can anyone help identify the possible reasons for this?
I have attempted multiple solutions to address it, but unfortunately, none have proven successful.
import { Component } from '@angular/core';
import { NavController, NavParams } from '@ionic/angular';
import {Announcements} from '../../../environments/environment';
import {AngularFireAuth} from 'angularfire2/auth';
import {AngularFireDatabase} from 'angularfire2/database';
import { take } from 'rxjs/operators';
import { Directive, HostListener, ElementRef } from '@angular/core';
@Component({
selector: 'app-add-our-announcements',
templateUrl: './add-our-announcements.page.html',
styleUrls: ['./add-our-announcements.page.scss'],
})
@Directive({
selector: 'ion-textarea[autosize]' // Attribute selector,
})
export class {
constructor(
private afauth: AngularFireAuth,
private afDatabase: AngularFireDatabase,
public navCtrl: NavController,
public navParams: NavParams,
public element: ElementRef) {
}
announcements = {} as Announcements;
@HostListener('document:keydown.enter', ['$event']) onKeydownHandler() {
this.adjust();
}
AfterViewInit() {
this.adjust();
}
adjust(): void {
const textArea = this.element.nativeElement.getElementsByTagName('textarea')[0];
textArea.style.overflow = 'hidden';
textArea.style.height = 'auto';
textArea.style.height = (textArea.scrollHeight + 42) + 'px';
}
createAnnouncements() {
this.afauth.authState.pipe(take(1)).subscribe(() => {
this.afDatabase.list(`announcements`).push(this.announcements)
.then(() => this.navCtrl.navigateForward('ListOfOurAnnouncementsPage'));
});
}
}