MCPcopy Create free account
hub / github.com/angular/components / _init

Method _init

src/material/datepicker/year-view.ts:294–309  ·  view source on GitHub ↗

Initializes this year view.

()

Source from the content-addressed store, hash-verified

292
293 /** Initializes this year view. */
294 _init() {
295 this._setSelectedMonth(this.selected);
296 this._todayMonth.set(this._getMonthInCurrentYear(this._dateAdapter.today()));
297 this._yearLabel.set(this._dateAdapter.getYearName(this.activeDate));
298
299 let monthNames = this._dateAdapter.getMonthNames('short');
300 // First row of months only contains 5 elements so we can fit the year label on the same row.
301 this._months.set(
302 [
303 [0, 1, 2, 3],
304 [4, 5, 6, 7],
305 [8, 9, 10, 11],
306 ].map(row => row.map(month => this._createCellForMonth(month, monthNames[month]))),
307 );
308 this._changeDetectorRef.markForCheck();
309 }
310
311 /** Focuses the active cell after the microtask queue is empty. */
312 _focusActiveCell() {

Callers 4

activeDateMethod · 0.95
ngAfterContentInitMethod · 0.95
ngOnChangesMethod · 0.45
updateTodaysDateMethod · 0.45

Calls 8

_setSelectedMonthMethod · 0.95
_createCellForMonthMethod · 0.95
setMethod · 0.80
markForCheckMethod · 0.80
todayMethod · 0.45
getYearNameMethod · 0.45
getMonthNamesMethod · 0.45

Tested by

no test coverage detected