S
S
sabirovvlad02018-09-21 14:12:35
Angular
sabirovvlad0, 2018-09-21 14:12:35

How to display full date using Angular?

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html';

})
export class AppComponent {
  birthDay : Data = new Data();
}

<div style="text-align:center">
  <h1>

    {{birthDay | data : dd-MM-yyyy}}
  </h1>
</div>


As a result, the answer is

Cannot find the name Data

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-09-21
@sabirovvlad0

birthDay property declaration, type and value - should be Date instead of Data. And when using the pipe, it is similar - it should be date instead of data. And the date format is the same string, where are the quotes? We fix:
birthDay: Date = new Date();
{{ birthDay | date : 'dd-MM-yyyy' }}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question