模板解析错误mdb卡未知元素

时间:2019-09-27 23:57:06

标签: angular bootstrap-4 angular-material

我正在使用角度应用程序,并且我在使用带有角度材料和bootstrap4的mdbbootstrap表单,我安装了两者,但是在编译时却出现了错误:模板解析错误mdb-card不是已知元素< / p>

我尝试添加模块...但是不起作用

<mdb-card>



  <!--Card content-->
  <mdb-card-body class="px-lg-5 pt-0">

    <!-- Form -->
    <form class="text-center" style="color: #757575;">

      <!-- Name -->
      <div class="md-form mt-3">
        <input type="text" id="materialContactFormName" class="form-control" mdbInput>
        <label for="materialContactFormName">Name</label>
      </div>

      <!-- E-mail -->
      <div class="md-form">
        <input type="email" id="materialContactFormEmail" class="form-control" mdbInput>
        <label for="materialContactFormEmail">E-mail</label>
      </div>

      <!-- Subject -->
      <span>Subject</span>
      <div class="row">
        <div class="col-md-12 mx-auto">
          <mdb-select [options]="optionsSelect" placeholder="Choose your option"></mdb-select>
        </div>
      </div>

      <!--Message-->
      <div class="md-form">
        <textarea type="text" id="materialContactFormMessage" class="form-control md-textarea" mdbInput></textarea>
        <label for="materialContactFormMessage">Message</label>
      </div>

      <!-- Copy -->
      <div class="row">
        <div class="col-md-6 mx-auto d-flex justify-content-center">
          <mdb-checkbox>Send me a copy of this message</mdb-checkbox>
        </div>
      </div>

      <!-- Send button -->
      <button mdbBtn color="info" outline="true" rounded="true" block="true" class="z-depth-0 my-4 waves-effect" mdbWavesEffect
        type="submit">Send</button>

    </form>
    <!-- Form -->

  </mdb-card-body>

</mdb-card>

1 个答案:

答案 0 :(得分:0)

    import { BrowserModule } from '@angular/platform-browser';
    import { HttpClientModule } from '@angular/common/http';
    import { NgModule } from '@angular/core';
    import { ReactiveFormsModule, FormsModule } from '@angular/forms';


    import { MDBBootstrapModule } from 'angular-bootstrap-md';
    import {MatExpansionModule} from '@angular/material/expansion';




import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { LandingPageComponent } from './landing-page/landing-page.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import {
  MatCardModule, MatToolbarModule, MatButtonModule, MatIconModule, MatSelectModule, MatMenuModule
  , MatDividerModule, MatInputModule, MatProgressBarModule, MatSidenavModule, MatListModule
} from '@angular/material';
import { HomeComponent } from './home/home.component';
import { LoadPipe } from './home/load.pipe';
import { GraphQLModule } from './graphql.module';
import { InsertComponent } from './form/insert.component';
import { StudentService } from './students.service';
import { FetchComponent } from './fetch/fetch.component';

const material = [MatCardModule, MatToolbarModule, MatButtonModule, MatIconModule, MatSelectModule, MatMenuModule
  , MatDividerModule, MatInputModule, MatProgressBarModule, MatSidenavModule, MatListModule];
@NgModule({
  declarations: [
    AppComponent,
    LandingPageComponent,
    HomeComponent,
    InsertComponent,
    FetchComponent,
    LoadPipe
  ],
  imports: [
    BrowserModule,
    ReactiveFormsModule,
    HttpClientModule,
    AppRoutingModule,
    ...material,
    BrowserAnimationsModule,
    GraphQLModule,
    FormsModule,
    MDBBootstrapModule.forRoot(),
    MDBBootstrapModule,
    MatExpansionModule


  ],
  providers: [ StudentService],
  bootstrap: [AppComponent]
})
export class AppModule {
  constructor() {}
}