angular初心者です。現在勉強のためangularでホテルの予約システムを作っています。作っていてhtml内ではパイプを使って表示ができていますが、コンポーネント内で今年の年だけを取得してhtmlに表示する方法もあるか疑問思いました。中々探しても良い方法が出てこないので皆様に方法があれば教えていただきたいです。
例えば・・・
[year.component.html]
<div class="top_content"> <div class="year">**{{}}**//ここに表示したい。</div> </div>[year.component.ts]
import { Component OnInit} from '@angular/core';
@Component({
template: require('./year.component.html'),
styles: [${require('./year.component.css')}
] //ここは割愛します
})
export class YearComponent{
/ここで年を取得してyear.component.htmlの{{}}に表示できるのか?/
}
あなたの回答
tips
プレビュー