Posts

Showing posts with the label angular-material

ERROR in @angular/material/autocomplete/typings/autocomplete-origin.d.ts: Type 'ElementRef' is not generic

ERROR in @angular/material/autocomplete/typings/autocomplete-origin.d.ts: Type 'ElementRef' is not generic I have downloaded some angular template which makes use of angular material library... I was trying the run this template on my local machine.. I have successfully executed the npm install .. but while ng serve .. I am getting the warnings & errors like below, npm install ng serve Your global Angular CLI version (6.0.7) is greater than your local version (1.7.4). The local Angular CLI version is used. To disable this warning use "ng config -g cli.warnings.versionMismatch false". @angular/compiler-cli@4.4.7 requires typescript@'>=2.1.0 <2.4.0' but 2.5.3 was found instead. Using this version can result in undefined behaviour and difficult to debug problems. Please run the following command to install a compatible version of TypeScript. npm install typescript@'>=2.1.0 <2.4.0' To disable this warning run "ng set warnings.type...

How to pass data to dialog of angular material 2

How to pass data to dialog of angular material 2 I am using dialog box of angular material2. I want to pass data to the opened component. Here is how I am opening dialog box on click of a button let dialogRef = this.dialog.open(DialogComponent, { disableClose: true, data :{'name':'Sunil'} }); On the documentation page there is data property, But I checked MdDialogConfig in my installed packages /** * Configuration for opening a modal dialog with the MdDialog service. */ export declare class MdDialogConfig { viewContainerRef?: ViewContainerRef; /** The ARIA role of the dialog element. */ role?: DialogRole; /** Whether the user can use escape or clicking outside to close a modal. */ disableClose?: boolean; /** Width of the dialog. */ width?: string; /** Height of the dialog. */ height?: string; /** Position overrides. */ position?: DialogPosition; } there is no data property in configuration cla...

Angular Material Datepicker: Change event not firing when selecting date

Angular Material Datepicker: Change event not firing when selecting date I'm using Angular and Angular Material's Datepicker. Everything is working fine for the most part, however I added a (change) event that is only working when the user manually types in a date. It does not get triggered when the user clicks on a date from the datepicker popup. To be clear, the value for date does in fact change when the user clicks on a date, it is just the (change) event, and ultimately my updateCalcs() function that for some reason doesn't get triggered. How can I trigger an event when the user clicks on a date from the datepicker? (change) date (change) updateCalcs() <md-input-container> <input mdInput [mdDatepicker]="datePicker" placeholder="Choose Date" name="date" [(ngModel)]="date" (change)="updateCalcs()" required> <button mdSuffix [mdDatepickerToggle]="datePicker"></button> </md-i...