Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

189
Visualizações
How do I implement a React Material-UI Component in an Angular2 app?

There is very little to no documentation of this out there. In fact, I am starting to doubt ng2 and React can play together. But I'm no expert, so I need your help.

According to Material UI docs for the AppBar here This is the code to add it to your component

import React from 'react';
import AppBar from 'material-ui/AppBar';

/**
 * A simple example of `AppBar` with an icon on the right.
 * By default, the left icon is a navigation-menu.
 */
const AppBarExampleIcon = () => (
  <AppBar
    title="Title"
    iconClassNameRight="muidocs-icon-navigation-expand-more"
  />
);

export default AppBarExampleIcon;

Problem is, this is documentation for a React Component, not an Angular2 Component.

This is as far as I got in my Angular2 component with the little information that is out there:

  import { Component, OnInit } from '@angular/core';
  import { React } from 'react';
  import { AppBar } from 'material-ui';


  @Component({
      selector: 'app-toolbar',
      templateUrl: './toolbar.component.html',
      styleUrls: ['./toolbar.component.css']
  })
  export class ToolbarComponent implements OnInit {
      AppBarExampleIcon = `
          <AppBar title="Title" iconClassNameRight="muidocs-icon-navigation-expand-more" />
      `;
  constructor() { }

  ngOnInit() {
  }

}

This results in nothing.

Has anyone tried this before?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

React and Angular cannot be mixed like that. Although both use the component syntax what is under the hood is completely different. Material-UI is a Material Design implementation specifically for React.

Try Angular Material instead, a Material Design implementation for Angular2. It's not as fully fleshed out like Material-UI (due to ng2 being newer) but there are still some components you should be able to use with a bit of modification - https://material.angular.io/components/component/toolbar

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda