Home / Groups

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.

To change the owner of any folder in ubuntu, you can follow the below cmd.

sudo chown -R shyam:root /var/www/html/mcqbuddy

This cmd will give change the owner of folder mcqbuddy to shyam.

Groups

5 Members joined | Created By: Mr. Dubey
6 Members joined | Created By: Mr. Dubey
8 Members joined | Created By: Mr. Dubey
7 Members joined | Created By: Mr. Dubey
6 Members joined | Created By: Mr. Dubey
6 Members joined | Created By: Mr. Dubey
8 Members joined | Created By: Mr. Dubey
8 Members joined | Created By: Deepak Sahoo
9 Members joined | Created By: Java
9 Members joined | Created By: Vijay Sangwan
15 Members joined | Created By: Nisha Gupta
31 Members joined | Created By: Priyanka Tomar
44 Members joined | Created By: Harikesh
46 Members joined | Created By: Chandan Das
48 Members joined | Created By: Geetam
50 Members joined | Created By: Kanak Sharma
49 Members joined | Created By: Ruchi Sharma
47 Members joined | Created By: Mr. Dubey
52 Members joined | Created By: Kanak Sharma
67 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.


Create an account | Already have account? Login