ng generate service info
Edit src/app/info.service.ts — replace with:
import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs';
@Injectable({ providedIn: 'root' }) export class InfoService { private apiUrl = 'https://localhost:44337/api/info/details'; // exact backend URL
constructor(private http: HttpClient) { }
getDetails(): Observable { return this.http.get(this.apiUrl); } }
Important: If your backend uses a different port, replace 44337 with the exact port from Visual Studio Project Properties → Web.
Create display component
Generate component:
ng generate component info-display
Edit src/app/info-display/info-display.component.ts:
import { Component, OnInit } from '@angular/core'; import { InfoService } from '../info.service';
@Component({ selector: 'app-info-display', templateUrl: './info-display.component.html' }) export class InfoDisplayComponent implements OnInit { name = ''; domain = ''; stack = '';
constructor(private infoService: InfoService) {}
ngOnInit(): void { this.infoService.getDetails().subscribe(data = { this.name = data.Name; this.domain = data.Domain; this.stack = data.Stack; }, err = console.error(err)); } }
Edit template src/app/info-display/info-display.component.html:
Name: {{ name }} Domain: {{ domain }} Stack: {{ stack }}
Add the component to root template src/app/app.component.html (replace contents):
Handling CORS / Mixed Content / Cert issues
If backend is https and Angular dev server is http, the browser allows http→https calls; but ensure backend cert is trusted. If you get NET::ERR_CERT_AUTHORITY_INVALID, open the https://localhost:44337 in browser and accept trust / certificate temporarily.
If CORS blocked: you either enabled CORS in Web API (we added that above) or use a proxy.
Proxy option (avoids CORS)
Create proxy.conf.json in Angular project root:
{ "/api": { "target": "https://localhost:44337", "secure": false, "changeOrigin": true, "logLevel": "debug" } }
Then run Angular with proxy:
ng serve --proxy-config proxy.conf.json
Now requests to /api/... from Angular (http://localhost:4200 ) are proxied to https://localhost:44337/api/ ... without CORS.
If you use proxy, change apiUrl in info.service.ts to relative path:
private apiUrl = '/api/info/details';
Run both and test
Start Web API in Visual Studio (F5).
Start Angular app:
If using proxy: ng serve --proxy-config proxy.conf.json
Otherwise: ng serve
Open Angular app:
Default: http://localhost:4200
You should see:
Name: Sairaj Domain: .NET Stack: dull stack
If you instead directly open the backend endpoint in browser: Global.asax
using System.Web; using System.Web.Http;
namespace Angulartoapi { public class WebApiApplication : HttpApplication { protected void Application_Start() { // This line registers all Web API routes when the application starts. GlobalConfiguration.Configure(WebApiConfig.Register); } } }
📁 Where to put this file
File name: Global.asax
Location: directly under your project root folder Example:
Angulartoapi │ ├── App_Start │ └── WebApiConfig.cs ├── Controllers │ └── InfoController.cs ├── Global.asax ✅ (this file) ├── Web.config └── Angulartoapi.csproj
✅ After adding or replacing:
Save the file.
Go to Build → Rebuild Solution.
Press Ctrl + F5 (run without debugging).
Visit this URL in your browser:
https://localhost:44337/api/info/details
You should now get clean JSON output:
{ "Name": "Sairaj", "Domain": ".NET", "Stack": "dull stack" } Unable to find package...
Read moreUnbelievably worst. I have never expected a restaurant which claims to be so prominent to be this pathetic. Both in terms of service and quality of food. On a Sunday night, usually where even the normal restaurants will be flooding, I surprisingly found this restaurant to be mostly vacant. We went there around 9 PM and we were informed by the staff the Chicken Biryani was over and it would take 30 minutes to prepare, which statement is unusual to hear from a restaurant that is famous for biryani. Generally, they never run out of biryani as it is the most ordered item. Firstly, there is no neatness. I have called the server and showed him the dirty stains on the drinking glass. He brushed it off saying that a kid sat on that table before us and he might have stained it. All the glasses on the table have too many fingerprints. I wonder would they ever clean them?! Secondly, the food took 45 mins to reach our tables. I never faced this problem in any other restaurants. The family sitting next to us also faced the same problem. Thirdly, the food arrived after a great wait and the taste? Pathetic!! I regretted my decision for going there in the first place. Fourthly, there is no professional approach for the staff. Except the girl who stands at the entrance inviting, there is no other person who would actually behave in a professional way. Now I totally understand how this restaurant even so famous have these many...
Read moreThere is no quality of food.. we have visited twice in a month recently, and for the first visit, the food taste is very poor and not boiled properly. We ordered Verity of biriyani, veg- tasteless, paneer -also tasteless, pieces are strong and not able to eat. Non veg biryani also kind of tasteless. As a paradise biryani lover, we used to go regularly.
And we thought, whatever we went that day is not good for me... but again we went second time, after 2 weeks. faced the same experience again without any changes, the quality of food is not upto the mark, even second time observed that the biryani is not boiled properly and tasteless.
The other important point is that the behaviour of staff, they are serving whatever the person they like, not serving in first come first serve. They are observing and doing what they want, even you asked again, they even not responding to your questions at all. My worst experience with staff.
Finally, i can say that, the new taste is not like the older biryani taste at all. The reason is not known, but the entire biryani taste changed. The first time we went with 8 members and nobody liked the food at all. The second time I went with my wife and children , but there was no change in the food at all, it felt like no more...
Read more