Home / Groups

When you are going to install MySql in your ubuntu (Linux machine) 

First Step:

run command sudo apt install mysql-server

this command will install mysql-server your machine. After successful installation. Type

sudo mysql -u root

This will allow to login into mysql without entering password. now set the password for root user.

Now set password for user ‘root’ 

alter user root@localhost identified by ‘Pass@123’;

this will set the password for user root@localhost.

now you can sign out by typing exit. and again login with root user and password. 

sudo mysql -u root -p 

You can run any command like show databases;

In view of speed between windows and Linux. I checked it in my pc. Linux is performing very well. 

Although windows is easy for use. Linux is little bit hard as most of the tasks are performed by commands. 

To create endpoint in your json-server for your angular application 

just edit your db.json file

{

   “posts”:{},

    “users”:{}

}

 

Your endpoints are live now on 

http://localhost:3000/posts [GET, POST, PUT, DELETE]

http://localhost:3000/users [GET, POST, PUT, DELETE]

hope it helped you.

to install json-server in angular application 

run npm install json-server

now create one file db.json in your root folder of your application.

to start json-server npx json-server db.json

your json server is live now on http://localhost:3000 port

To map the query params with angular routes. Follow the below doc

in angular 17, app.routes.ts 

{path:'posts/category/:catId', component:PostByCategoryComponent}

 

now in PostByCategoryComponent 

import {ActivatedRoute} from ‘@angular/router’;

export class PostByCategoryComponent {

 constructor(private router:ActivatedRoute){}

 ngOnInit(){
   this.router.params.subscribe(res=>{
     console.log(res);
     
   });
   
 }

}

 

this will show in console like 

{catId:2}

thanks and share your experience on angular here….

Suppose you have one angular application where you want to open a popup on some button click and pass data to that popup component and also want data from popup component to parent component.

suppose you have two components

  1. post.component.ts
  2. popup.component.ts

now in post.component.ts there is one method openPopup()

openPopup(){

const dialogRef = this.dialog.open(PopupComponent, {

     data:{postId:1}

      }

}

now in popup.component.ts you can received this data by adding one import 

import {MAT_DIALOG_DATA} from ‘@angular/material/dialog’;

export class PopupComponent{

constructor(@Inject(MAT_DIALOG_DATA) public data:any){}
 

//you can use this data object to fetch post details and to show in popup.component.html

}

 

Now comes the main thing. How to return data back to post.component.ts from popup component. for that you have to make one eventEmitter for this purpose. 

@Output()

data = new EventEmitter();

onPopupClose(){

this.data.emit(obj);

}

 

You can receive this value in parent component by using matDialogRef

matDialogRef.componentInstance.data.subscribe(data=>{

console.log(data):

})

 

this way you can pass data to popup component and back. Thanks

 Hi guys, during making an app in angular 17, i encountered one problem which was Nullinjectorerror: no provider for httpclient so i was unable to use httpclientModule in any of my angular services. so i just opened app.config.ts file and imported providerHttpClient and used it in providers:[]

 

this is the complete view of my app.config.ts

import { ApplicationConfig, NgModule } from '@angular/core';
import { provideRouter } from '@angular/router';
import { provideHttpClient } from '@angular/common/http';
import { routes } from './app.routes';
import { provideAnimations } from '@angular/platform-browser/animations';

export const appConfig: ApplicationConfig = {
 providers: [provideRouter(routes), provideAnimations(), provideHttpClient()],
 
};
 

This way httpClient was working fine.

If you are struck to open your /var/www/html/ files in vs code and these files are not editable. You can open the folder as a sudo cmd.

Go to the directory /var/www/html/web_folder and open terminal there and hit the below command.

sudo code . --no-sandbox --user-data-dir /home/shyam/Development/PHP/mcqbuddy/

By this way you will be able to edit your files in vs code.

Thanks and share your experience with others as well.

Groups

2 Members joined | Created By: Shyam Dubey
4 Members joined | Created By: Shyam Dubey
6 Members joined | Created By: Shyam Dubey
5 Members joined | Created By: Shyam Dubey
4 Members joined | Created By: Shyam Dubey
4 Members joined | Created By: Shyam Dubey
5 Members joined | Created By: Shyam Dubey
6 Members joined | Created By: Deepak Sahoo
6 Members joined | Created By: Java
7 Members joined | Created By: Vijay Sangwan
13 Members joined | Created By: Nisha Gupta
29 Members joined | Created By: Priyanka Tomar
42 Members joined | Created By: Harikesh
44 Members joined | Created By: Chandan Das
46 Members joined | Created By: Geetam
48 Members joined | Created By: Kanak Sharma
47 Members joined | Created By: Ruchi Sharma
45 Members joined | Created By: Shyam Dubey
50 Members joined | Created By: Kanak Sharma
66 Members joined | Created By: Vishal Gupta

You need an account to perform this action. Click on Continue with google for single tap login or create an account.

Continue with google

Create an account | Already have account? Login