'md-input' is not a known element
Bug, feature request, or proposal:
Hello! I have an angular project to which I added angular/material! I followed the steps in the getting started, but I got this error:
`zone.js:355Unhandled Promise rejection: Template parse errors: 'md-input' is not a known element:
- If 'md-input' is an Angular component, then verify that it is part of this module.
- If 'md-input' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schema' of this component to suppress this message. ("
[ERROR ->] "): SignInComponent@7:10`
in packages.json I have:
"dependencies": { "@angular/common": "2.0.0", "@angular/compiler": "2.0.0", "@angular/core": "2.0.0", "@angular/forms": "2.0.0", "@angular/http": "2.0.0", "@angular/material": "^2.0.0-alpha.9-3", "@angular/platform-browser": "2.0.0", "@angular/platform-browser-dynamic": "2.0.0", "@angular/router": "3.0.0", "@types/hammerjs": "^2.0.33", "angularfire2": "2.0.0-beta.5", "core-js": "~2.4.1", "firebase": "3.3.0", "hammerjs": "^2.0.8", "rxjs": "5.0.0-beta.12", "zone.js": "~0.6.25" }, "devDependencies": { "@types/hammerjs": "2.0.32", "@types/core-js": "~0.9.33", "@types/jasmine": "~2.2.34", "@types/node": "~6.0.39", "@types/request": "0.0.30", "autoprefixer": "~6.4.1", "coveralls": "~2.11.14", "cross-env": "~2.0.1", "css-loader": "~0.25.0", "del-cli": "~0.2.0", "eslint": "~3.5.0", "express": "~4.14.0", "extract-text-webpack-plugin": "2.0.0-beta.4", "firebase-tools": "3.0.7", "html-webpack-plugin": "~2.22.0", "istanbul-instrumenter-loader": "~0.2.0", "jasmine-core": "~2.5.2", "karma": "~1.3.0", "karma-chrome-launcher": "~2.0.0", "karma-coverage": "~1.1.1", "karma-jasmine": "~1.0.2", "karma-mocha-reporter": "~2.2.0", "karma-sourcemap-loader": "~0.3.7", "karma-webpack": "~1.8.0", "minx": "r-park/minx.git", "morgan": "~1.7.0", "node-sass": "~3.10.0", "nodemon": "~1.10.2", "npm-run-all": "~3.1.0", "postcss-loader": "~0.13.0", "raw-loader": "~0.5.1", "remap-istanbul": "~0.6.4", "sass-loader": "~4.0.2", "style-loader": "~0.13.1", "ts-helpers": "~1.1.1", "ts-loader": "~0.8.2", "tslint": "~3.15.1", "typescript": "~2.0.2", "typings": "~1.3.3", "webpack": "2.1.0-beta.22", "webpack-dev-server": "2.1.0-beta.4", "webpack-md5-hash": "~0.0.5", "winston": "~2.2.0", "yargs": "~5.0.0" },
The template is:
<form (ngSubmit)="comp.login()" [formGroup]="userForm" #comp> <div class="form-group"> <label for="email">Email</label> <md-input type="text" class="form-control" formControlName="email" placeholder="email"></md-input> </div> <div class="form-group"> <label for="password">Password</label> <md-input type="text" class="form-control" formControlName="password" placeholder="password"></md-input> </div> <md-button type="submit" class="sign-in__button small right" (click)="save()" [disabled]="!userForm.valid">Submit</md-button> </form>
And the component that uses it:
`import { Component } from '@angular/core'; import { Router } from '@angular/router'; import { AuthService } from '../services/auth-service'; import { FormBuilder, FormGroup } from '@angular/forms';
import { MdInput,MdButton, } from '@angular/material';
@Component({ styles: [ require('./sign-in.scss') ], template:require('./sign-in.html') })
export class SignInComponent { userForm: FormGroup; constructor(private auth: AuthService, private router: Router,private fb:FormBuilder) { this.userForm = fb.group({ email:fb.control(''), password:fb.control('') }) }
login():void{ this.auth.signInWithCustomAccount(this.userForm.value.email,this.userForm.value.password) .then(() => this.postSignIn()); }
signInWithGithub(): void { this.auth.signInWithGithub() .then(() => this.postSignIn()); }
signInWithGoogle(): void { this.auth.signInWithGoogle() .then(() => this.postSignIn()); }
signInWithTwitter(): void { this.auth.signInWithTwitter() .then(() => this.postSignIn()); }
signUp(): void { this.router.navigate(['/sign-up']); }
private postSignIn(): void { this.router.navigate(['/dashboard']); } } `
Provide a (non)working reproduction on plnkr, here's a template http://plnkr.co/edit/evTZCPrVix1XYcNK753K?p=preview with md-input working just fine.
Sounds like you're not importing the MaterialModule.
There's been some breaking changes in @angular/material 2.0.0-beta.2 flannel-papaya (2017-02-15)
https://github.com/angular/material2/blob/master/CHANGELOG.md
jelbourn. I have imported and it show's : Template parse errors: 'md-input' is not a known element:. But i have imported universalModule in app.component typescript file.
@ponmani Use md-input-container https://material.angular.io/components/component/input
Once again getting this error with the newest beta:
Uncaught Error: Template parse errors:
'md-input-contianer' is not a known element:
1. If 'md-input-contianer' is an Angular component, then verify that it is part of this module.
2. If 'md-input-contianer' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
Changepoint Date:
[ERROR ->]<md-input-contianer>
<input mdInput placeholder="2017-04-01" [(ngModel)]="changepoint">
</md-input-"): ng:///AppModule/FiltersComponent.html@8:0
at syntaxError (http://localhost:3000/vendor.bundle.js:15579:34)
at TemplateParser.webpackJsonp../node_modules/@angular/compiler/@angular/compiler.es5.js.TemplateParser.parse (http://localhost:3000/vendor.bundle.js:26699:19)
at JitCompiler.webpackJsonp../node_modules/@angular/compiler/@angular/compiler.es5.js.JitCompiler._compileTemplate (http://localhost:3000/vendor.bundle.js:40851:39)
at http://localhost:3000/vendor.bundle.js:40771:62
at Set.forEach (native)
at JitCompiler.webpackJsonp../node_modules/@angular/compiler/@angular/compiler.es5.js.JitCompiler._compileComponents (http://localhost:3000/vendor.bundle.js:40771:19)
at http://localhost:3000/vendor.bundle.js:40658:19
at Object.then (http://localhost:3000/vendor.bundle.js:15568:148)
at JitCompiler.webpackJsonp../node_modules/@angular/compiler/@angular/compiler.es5.js.JitCompiler._compileModuleAndComponents (http://localhost:3000/vendor.bundle.js:40657:26)
at JitCompiler.webpackJsonp../node_modules/@angular/compiler/@angular/compiler.es5.js.JitCompiler.compileModuleAsync (http://localhost:3000/vendor.bundle.js:40586:37)
In my AppModule
import {
MdAutocompleteModule,
MdButtonModule,
MdButtonToggleModule,
MdCardModule,
MdCheckboxModule,
MdChipsModule,
MdCoreModule,
MdTableModule,
MdDatepickerModule,
MdDialogModule,
MdExpansionModule,
MdGridListModule,
MdIconModule,
MdInputModule,
MdListModule,
MdMenuModule,
MdNativeDateModule,
MdPaginatorModule,
MdProgressBarModule,
MdProgressSpinnerModule,
MdRadioModule,
MdRippleModule,
MdSelectModule,
MdSidenavModule,
MdSliderModule,
MdSlideToggleModule,
MdSnackBarModule,
MdSortModule,
MdTabsModule,
MdToolbarModule,
MdTooltipModule,
StyleModule
} from '@angular/material';
...
imports: [
MdAutocompleteModule,
MdButtonModule,
MdButtonToggleModule,
MdCardModule,
MdCheckboxModule,
MdTableModule,
MdDatepickerModule,
MdNativeDateModule,
MdDialogModule,
MdExpansionModule,
MdGridListModule,
MdIconModule,
MdInputModule,
MdListModule,
MdMenuModule,
MdCoreModule,
MdPaginatorModule,
MdProgressBarModule,
MdProgressSpinnerModule,
MdRadioModule,
MdRippleModule,
MdSelectModule,
MdSidenavModule,
MdSlideToggleModule,
MdSliderModule,
MdSnackBarModule,
MdSortModule,
MdTabsModule,
MdToolbarModule,
MdTooltipModule,
MdNativeDateModule,
StyleModule,
...
Misspelled md-input-contianer => md-input-container
Alternate way is to use class attribute of button or any relevant element. Like - <button class='md-button md-raised'> Foo </button>. Ultimately md-button or md-raised are css classes.
Getting below error:
'mat-input' is not a known element:
- If 'mat-input' is an Angular component, then verify that it is part of this module.
- If 'mat-input' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
[ERROR ->]
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.