How to get dropdown values through from angular api??
below shared my code, could u guys help me please
App.Component.ts
- constructor(private httpService: HttpClient){}
- myInsuredTypes: string[];
- selected = null;
- ngOnInit () {
- this.httpService.get('http://192.168.1.51/masterapi/api/GetInsurance').subscribe(
- data => {
- this.myInsuredTypes = data as string []; // FILL THE ARRAY WITH DATA.
- },
- (err: HttpErrorResponse) => {
- console.log (err.message);
- }
- );
- }
App.component.html
- "float:left;padding:10px;margin:0 auto;">
- >
- >{{description}}
{{ selected }}
App.module.ts
- // API Section
- import { HttpClientModule } from '@angular/common/http';
- import { FormsModule } from '@angular/forms';
Errors comes
Access to XMLHttpRequest at 'http://192.168.1.51/masterapi/api/GetInsurance/' from origin 'http://localhost:4200' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Saravanan NpPosted Mar 19, 2019, 6:47 AM
Saravanan NpPosted Mar 19, 2019, 6:43 AM
Puneet KankarPosted Mar 13, 2019, 11:41 AM
Mohd KashifPosted Mar 13, 2019, 5:47 AM
Rajeesh MenothPosted Mar 13, 2019, 2:37 AM