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

Method constructor

src/aria/tabs/tab-panel.ts:94–121  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

92 private readonly _tabContent = contentChild(TabContent);
93
94 constructor() {
95 // Connect the panel's hidden state to the DeferredContentAware's visibility.
96 afterRenderEffect({
97 write: () => {
98 this._deferredContentAware.contentVisible.set(this.visible());
99 },
100 });
101
102 // Check for any violations after the DOM has been updated.
103 if (typeof ngDevMode === 'undefined' || ngDevMode) {
104 afterRenderEffect({
105 read: () => {
106 const violations: string[] = [];
107
108 if (!this._tabContent()) {
109 violations.push('ngTabPanel must have an ngTabContent structural directive to render.');
110 }
111 if (!this._tabs._tabMap().has(this.value())) {
112 violations.push(
113 `ngTabPanel with value '${this.value()}' does not have a corresponding ngTab.`,
114 );
115 }
116
117 reportViolations(violations, this.element);
118 },
119 });
120 }
121 }
122
123 ngOnInit() {
124 this._tabs._collection.register(this);

Callers

nothing calls this directly

Calls 5

reportViolationsFunction · 0.90
setMethod · 0.80
visibleMethod · 0.80
pushMethod · 0.65
valueMethod · 0.45

Tested by

no test coverage detected