Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

184
Vistas
Extending Angular Material2 MdTab component

I'm attempting to extend one of the Material components, MdTabGroup. Everything works fine with the out-of-the box MdTabGroup component - the material library is correctly imported into the module etc.

Here's the extended component:

@Component({
    selector: 'md-custom-tab-group',
    templateUrl: 'custom-tab-group.html',
    ....
})
export class MdCustomTabGroup extends MdTabGroup {
  constructor( private _r : Renderer) {
    super(_r);
  }
}

The new component is imported and declared in the app module, and is created thus:

<md-custom-tab-group>
    <md-tab>one</md-tab>
    <md-tab>two</md-tab>
</md-custom-tab-group>

The template for the custom tab group (custom-tab-group.html) is identical to the one in material, e.g.

<div class="mat-tab-body-wrapper" #tabBodyWrapper>
    <md-tab-body role="tabpanel"
                 *ngFor="let tab of _tabs; let i = index"
                 ...
                 [content]="tab.content"
                 ...>
    </md-tab-body>
</div>

When run, the _tabs ViewChildren collection is getting correctly populated - it consists of the md-tab declarations in the original markup, interpreted as a Material tab component. However, the custom-tab-group.html template is not valid. The template parser now doesn't know what 'md-tab-body' is.

Specifically -

Can't bind to 'content' since it isn't a known property of 'md-tab-body'.

but I don't think it knows what md-tab-body is at all when it picks up the new template.

The question is - how can I correct this behavior and get the extended component working?

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Not a good answer but this issue that is being tracked seems to be the root of it.

https://github.com/angular/material2/issues/9216

Once they include MatTabBody, MatTabHeader and MatTabLabelWrapper in the export list you should be able to extend it.

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda