mdInput is not working with Angular2 Quickstart application
Bug, feature request, or proposal:
Bug
What is the expected behavior?
The mdInput component should work
What is the current behavior?
Its is not recognized the binding property md-input <input mdInput [(ngModel)]="hero.name" placeholder="name"> /md-input
What are the steps to reproduce?
Providing a Plunker (or similar) is the best way to get the team to see your issue. Plunker template: http://plnkr.co/edit/o077B6uEiiIgkC0S06dd
What is the use-case or motivation for changing an existing behavior?
Which versions of Angular, Material, OS, browsers are affected?
angular 2.4.0" ,typescript 2.0.10
Is there anything else we should know?
IN Package.json { "name": "master-details-with-ANG2", "version": "1.0.0", "description": "QuickStart package.json from the documentation, supplemented with testing support", "scripts": { "start": "tsc && concurrently "tsc -w" "lite-server" ", "e2e": "tsc && concurrently "http-server -s" "protractor protractor.config.js" --kill-others --success first", "lint": "tslint ./app/**/*.ts -t verbose", "lite": "lite-server", "pree2e": "webdriver-manager update", "test": "tsc && concurrently "tsc -w" "karma start karma.conf.js"", "test-once": "tsc && karma start karma.conf.js --single-run", "tsc": "tsc", "tsc:w": "tsc -w" }, "keywords": [], "author": "", "license": "MIT", "dependencies": { "@angular/common": "~2.4.0", "@angular/compiler": "~2.4.0", "@angular/core": "~2.4.0", "@angular/forms": "~2.4.0", "@angular/http": "~2.4.0", "@angular/material": "^2.0.0-beta.1", "@angular/platform-browser": "~2.4.0", "@angular/platform-browser-dynamic": "~2.4.0", "@angular/router": "~3.4.0", "@angular2-material/button": "^2.0.0-alpha.8-2", "@angular2-material/button-toggle": "^2.0.0-alpha.8-2", "@angular2-material/card": "^2.0.0-alpha.8-2", "@angular2-material/checkbox": "^2.0.0-alpha.8-2", "@angular2-material/core": "^2.0.0-alpha.8-2", "@angular2-material/grid-list": "^2.0.0-alpha.8-2", "@angular2-material/icon": "^2.0.0-alpha.8-2", "@angular2-material/input": "^2.0.0-alpha.8-2", "@angular2-material/menu": "^2.0.0-alpha.8-2", "@angular2-material/progress-bar": "^2.0.0-alpha.8-2", "@angular2-material/progress-circle": "^2.0.0-alpha.8-2", "@angular2-material/radio": "^2.0.0-alpha.8-2", "@angular2-material/sidenav": "^2.0.0-alpha.8-2", "@angular2-material/slide-toggle": "^2.0.0-alpha.8-2", "@angular2-material/slider": "^2.0.0-alpha.8-2", "@angular2-material/tabs": "^2.0.0-alpha.8-2", "@angular2-material/toolbar": "^2.0.0-alpha.8-2", "@angular2-material/tooltip": "^2.0.0-alpha.8-2", "angular-in-memory-web-api": "~0.2.4", "core-js": "^2.4.1", "hammerjs": "^2.0.8", "rxjs": "5.0.1", "systemjs": "0.19.40", "zone.js": "^0.7.4" }, "devDependencies": { "concurrently": "^3.1.0", "lite-server": "^2.2.2", "typescript": "~2.0.10", "canonical-path": "0.0.2", "http-server": "^0.9.0", "tslint": "^3.15.1", "lodash": "^4.16.4", "jasmine-core": "~2.4.1", "karma": "^1.3.0", "karma-chrome-launcher": "^2.0.0", "karma-cli": "^1.0.1", "karma-jasmine": "^1.0.2", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~4.0.14", "rimraf": "^2.5.4", "@types/node": "^6.0.46", "@types/jasmine": "^2.5.36" }, "repository": {} }
app.module.ts In app.module.ts if i m importing MaterialModule.forRoot() then it throws the error.
import { NgModule ,ModuleWithProviders} from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { FormsModule } from '@angular/forms';
import { MaterialModule } from '@angular/material';
import { AppComponent } from './app-component/app.component'; import { HeroDetailComponent } from './hero-detail-component/hero-detail.component'; import { HeroesComponent } from './heroes-component/heroes.component'; import { DashboardComponent } from './dashboard-component/dashboard.component'; import {HeroService} from './service/hero.service';
import { AppRoutingModule } from './app-routing.module'; import { AppMaterialModule } from './app.material.module';
@NgModule({ imports:[ BrowserModule , FormsModule, AppRoutingModule, AppMaterialModule ],
declarations: [ AppComponent , HeroDetailComponent, HeroesComponent, DashboardComponent ], providers: [ HeroService ], bootstrap: [ AppComponent ]
}) export class AppModule {
}
Here is my app.material.module.ts
import { NgModule ,ModuleWithProviders} from '@angular/core';
//import { MaterialModule } from '@angular/material'; import { MdCardModule } from '@angular2-material/card'; import { MdButtonModule } from '@angular2-material/button'; import { MdIconModule ,MdIconRegistry } from '@angular2-material/icon'; import { MdInputModule } from '@angular2-material/input'; import { MdCheckboxModule } from '@angular2-material/checkbox'; import { MdButtonToggleModule } from '@angular2-material/button-toggle'; import { MdGridListModule } from '@angular2-material/grid-list'; import { MdListModule } from '@angular2-material/list'; import { MdMenuModule } from '@angular2-material/menu'; import { MdProgressBarModule } from '@angular2-material/progress-bar'; import { MdProgressCircleModule } from '@angular2-material/progress-circle'; import { MdRadioModule } from '@angular2-material/radio'; import { MdSidenavModule } from '@angular2-material/sidenav'; import { MdSliderModule } from '@angular2-material/slider'; import { MdSlideToggleModule } from '@angular2-material/slide-toggle'; import { MdTabsModule } from '@angular2-material/tabs'; import { MdToolbarModule } from '@angular2-material/toolbar'; import { MdTooltipModule } from '@angular2-material/tooltip';
import { MdRippleModule, RtlModule, PortalModule, OverlayModule , MdUniqueSelectionDispatcher} from '@angular2-material/core';
const MATERIAL_MODULES = [ MdCardModule, MdButtonModule, MdIconModule, MdInputModule, MdCheckboxModule, MdButtonToggleModule, MdGridListModule, MdListModule, MdMenuModule, MdProgressBarModule, MdProgressCircleModule, MdRadioModule, MdSidenavModule, MdSliderModule, MdSlideToggleModule, MdTabsModule, MdToolbarModule, MdTooltipModule, MdRippleModule, OverlayModule, PortalModule, RtlModule
];
@NgModule({ imports:[ MATERIAL_MODULES ], exports:[ MATERIAL_MODULES ] , providers: [ MdIconRegistry ,MdUniqueSelectionDispatcher],
}) export class AppMaterialModule { static forRoot(): ModuleWithProviders { return { ngModule: AppMaterialModule }; } }
so in my hero-detail template ,i m having a text box which contains the values for edit
<input [(ngModel)]="hero.name" placeholder="name"/> //this one works but instead of this if i m using angular material component is not working.
md-input <input mdInput [(ngModel)]="hero.name" placeholder="name"> /md-input
i found the issue
i have to use in the md-input tag like this
<md-input [(ngModel)]="hero.name" placeholder="name">
</md-input>
not in input tag
<md-input-container class="fullwidth">
<input type="text" mdInput placeholder="First Name" id="firstname" [(ngModel)]="address.firstname" name="firstname">
</md-input-container>
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.