Pass and retrieve data in Mat-Dialog

// Pass data to Dialog
constructor(
    private _dialog: MatDialog
) {}

someFunction(whatever) {
    let dialogConfig = new MatDialogConfig();

    
    dialogConfig.data = {
      whatever: whatever,
    };

    this._dialog.open(
      MyDialog,
      dialogConfig
    );
}


// Retrieve within the dialog
constructor(
    @Inject(MAT_DIALOG_DATA) private _inputParams: any
) {}

ngOnInit(): void {
    this.whatever = this._inputParams.whatever;
}

Update global npm packages

// Updating all globally-installed packages
npm update -g
// or 
npm install npm@latest -g

// Determining which global packages need updating
npm outdated -g --depth=0

// Updating a single global package
npm update -g <package_name>

ref

nginx error with Angular routing

404 Not Found

nginx/1.14.0 (Ubuntu)

Solution:

/etc/nginx/sites-available/yoursite

#change this line:
try_files $uri $uri/ =404;
#to this:
try_files $uri $uri/ /index.html;
#then restart nginx
sudo systemctl restart nginx

Angular setup

// create new app
ng new <PROJECT_NAME>
cd <PROJECT_NAME>

// install angular material
npm i @angular/material @angular/animations @angular/cdk hammerjs

// generate components
ng g c <COMPONENT_NAME>

// generate services
ng g s <SERVICE_NAME>