Home / Groups
This group has no posts.
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
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
You need an account to perform this action. Click on Continue with google for single tap login or create an account.