How to return json object from link url angular 7?

27 views
Skip to first unread message

ahmed elbarbary

unread,
Dec 27, 2019, 8:26:01 PM12/27/19
to Angular and AngularJS discussion
i need to return json object  from url 
 so my question How to write service and calling
this service on component ngoninit event
I actually need to return object from this url
so that 
How to write service and calling on component ngoninit event
apiservice.ts
create service calling this link
and on component.ts
ngoninit


{
//How to call service and return data on variable
}


data returned as following
{
"_index": "partsdb",
"_type": "_doc",
"_id": "10",
"_version": 32,
"_seq_no": 115683922,
"_primary_term": 2,
"found": true,
"_source": {
"PID": 10,
"CID": 1005070,
"CN": "Texas Instruments Incorporated",
"PN": "THS6002CDWP",
"Eq": "Driver, Receiver and Transceiver Interface Transceiver 2 2 20HSOIC Tube",
"FID": 4,
"FN": "THS6002",
"PaID": 5260,
"PaN": "20-HSOIC",
"PLID": 523842,
"PLN": "Driver, Receiver and Transceiver Interfaces",
"PLC": "Active",
"PIDT": 2007,
"ObY": 2024,
"NPI": false,
"FT": "THS6002 Dual Differential Line Driver/Receiver",
"DS": "277399925",
"FIDT": 1998,
"LCRev": 20777025,
"Masked_ID": 6012356,
"Compliance": [
{
"RS": "Compliant",
"RET": "None",
"RV": "2015/863",
"RST": "Datasheet",
"CRS": "Compliant",
"HTS": "Compliant",
"RES": "Compliant",
"RESV": "JUL 2019 (201)",
"PNDR": 49416942,
"RHV": 963041,
"RECV": 273158534,
"HFR": 49416942
}
],
"PartScore": [
{
"LCS": 46,
"MS": 15,
"RS": 11,
"SS": 5,
"CS": 0,
"S": 80,
"PRSID": 3,
"PAS": 5,
"FC": 0,
"CEL": 5,
"LTS": 3,
"FOD": "",
"IsMultiPackage": true,
"IsSolePackage": false,
"NumberOfAssembly": 1,
"NumberOfFab": 0,
"NumberOfFactory": 0,
"PackageUsage": 2,
"TechnologyStage": ""
}
],
"Manufacturing": [
{
"LFP": "NiPdAu",
"R": 10792132,
"MSL": "2",
"MSLR": 10792132,
"BM": "Cu",
"MRT": "260°C",
"MRTR": 10792132,
"MVT": "N/A",
"MVTR": 277399925,
"RST": "30",
"WST": "N/A",
"NOR": "3"
}
],
"Package": [
{
"LS": "Gull Wing",
"CPN": "20-HSOIC",
"NPN": "20-SOIC (0.295\", 7.50mm Width) Exposed Pad",
"PC": "20",
"MT": "Surface Mount",
"PPM": "1.27",
"JEDEC": "",
"D": "12.82 x 7.52 x 2.65",
"A": 96.406,
"T": 2.650,
"MXbdLn": "12.95",
"MxBdW": "7.59",
"MXbdH": "2.5",
"MXbdD": "N/R"
}

Olaleye Israel

unread,
Dec 27, 2019, 11:02:48 PM12/27/19
to ang...@googlegroups.com
Get your http client module import it in your respective module.
Also import it in your service, do the dependency injection thingy, create the method to be called on the service.
Use the module like this

...
Const url = 'u/r/l';
This.http.get(url, options);
...


See the docs for more

--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/angular/fec3b1df-2f06-40ba-a446-951e90defa5b%40googlegroups.com.

Charul Chavda

unread,
Dec 27, 2019, 11:33:41 PM12/27/19
to ang...@googlegroups.com
I would suggest take a crash course before jumping on to a framework. As what you are asking is pretty trivial for the framework.

Regards,
Charul
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/angular/CANmMz6QW9uEqYzb5Y1W_vsKXhXBvQeuNVktH-fmdGgF%2BoKRUEA%40mail.gmail.com.

Tito

unread,
Jan 2, 2020, 8:41:33 AM1/2/20
to Angular and AngularJS discussion
I think this guy is involved in a project way above his skill set and is asking others to do his work for him. A lot of question on this forum
Reply all
Reply to author
Forward
0 new messages