D
D
Django Almighty2022-01-24 13:28:25
Angular
Django Almighty, 2022-01-24 13:28:25

How can you define a class that implements an interface via html?

Hello.
There is an interface

export interfaces IFilter
{
   id : string
   description : string
   type: number
}


there are two classes
export class InputFilter impl IFilter
{
   id : string
   description : string
   inputString: string
   type: number
}

export class InputDate impl IFilter
{
   id : string
   description : string
   inputDate: string
   type: number
}


In the component, there is an array filters : IFilter[]

Why can't I access a property of the InputDate class like this, and how can I access it? Why doesn't html understand the instanceof check?
<div *ngFor="let filter of filters"> 
   <div *ngIf="type == 1">
    {{ filter.inputDate }}
  </div>
</div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shvets, 2022-01-24
@12345678XYU87654321

because implements only exists in typescript, as an aid to good advice to the programmer, and disappears at compilation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question