Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to open component as a dialog in angular

//For this We need need Angular Material(MatDialog)
//Make sure you import matDialog in app module like:
import { MatDialogModule } from '@angular/material/dialog';

//Now Go to ts file from where you want to open Dialog and Do following:
const dialogRef = this.dialog.open(SampleComponent,
      { data: { ID: data.Id, Name: data.Name }, width: '1000px', height: '1000px' }
    );
//Note: Component Name is: SampleComponent and we are passing data to the dialog component.
//and to receive this data in Sample Component We need to inject it in constructor like this.

@Inject(MAT_DIALOG_DATA) public data: any
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript to remove few items from array 
Javascript :: basic express graphql 
Javascript :: factorial javascript function 
Javascript :: add formdata javascript 
Javascript :: getting average of array javascript 
Javascript :: to uppercase js 
Javascript :: javascript eval passing variable 
Javascript :: react js marked import and use 
Javascript :: how to set css variables in javascript 
Javascript :: how to target child element of an event object in JS 
Javascript :: nodejs console.log timestampt 
Javascript :: convert queryset to json django 
Javascript :: convert jquery fadeOut function to pure javascript code 
Javascript :: javascript enable clipboard 
Javascript :: deleteOne 
Javascript :: get last word in string js 
Javascript :: check if object has key lodash 
Javascript :: set default date today js 
Javascript :: count array filter javascript 
Javascript :: access django template variable in javascript 
Javascript :: how to identify specific letter from a string in javascript 
Javascript :: data type in javascript 
Javascript :: node js async delay 
Javascript :: date range filter 
Javascript :: conditional classname prop react 
Javascript :: create csv file javascript 
Javascript :: Javascript Get day number in year from date 
Javascript :: how to change root variable css 
Javascript :: app use morgan 
Javascript :: electron send message from renderer to main 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =