Hello there, I'm fairly new to Angular and I've been encountering an issue with object declaration in one of my angular components.
import { Component } from '@angular/core';
@Component({
selector: 'app-clases',
templateUrl: './clases.component.html'
})
export class ClasesComponent
{
alerta:string="alert-danger";
constructor() { }
propiedades:Object = {
danger: false
}
}
Whenever I try to compile this code, I encounter an error:
***Compiled with problems:
Error: src/app/components/clases/clases.component.html:9:76 - error TS2339: Property 'danger' does not exist on type 'Object'.
9 <h3 [ngClass]="{'text-danger':propiedades.danger,'text-info':!propiedades.danger}"><
~~~~~~
src/app/components/clases/clases.component.ts:5:16
5 templateUrl: './clases.component.html'
~~~~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component ClasesComponent.
It appears that the 'danger' property in the class is not recognized causing this error to be thrown.
Any suggestions or help would be greatly appreciated!