# Angular Local Dev Testing

**URL:** <http://forum.companieshouse.gov.uk/t/angular-local-dev-testing/1895>\
**Category:** API Issues\
**Created:** [July 3, 2018, 8:04am UTC](http://forum.companieshouse.gov.uk/t/angular-local-dev-testing/1895 "2018-07-03T08:04:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![greg2](http://forum.companieshouse.gov.uk/user_avatar/forum.companieshouse.gov.uk/greg2/32/593_2.png) [@greg2](http://forum.companieshouse.gov.uk/u/greg2)\
**Post date:** [July 3, 2018, 8:04am UTC](http://forum.companieshouse.gov.uk/t/angular-local-dev-testing/1895/1 "2018-07-03T08:04:23Z")

</div>

I have been going around in circles and would appreciate some help please. I have got an Angular 6 app running locally under the domain of [http://gregduffield.com:4200](http://gregduffield.com:4200) I have added this to the API Key as an authorised Domain but I am still getting a CORS error

```
Failed to load https://api.companieshouse.gov.uk/search/companies?q=barclays: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://gregduffield.com:4200' is therefore not allowed access.

```

Any help would be much appreciated.

---

<div class="post-metadata">

**Author:** ![MArkWilliams](http://forum.companieshouse.gov.uk/user_avatar/forum.companieshouse.gov.uk/markwilliams/32/194_2.png) [@MArkWilliams](http://forum.companieshouse.gov.uk/u/MArkWilliams)\
**Post date:** [July 3, 2018, 9:34am UTC](http://forum.companieshouse.gov.uk/t/angular-local-dev-testing/1895/2 "2018-07-03T09:34:28Z")

</div>

Please search the forum for Access-Control-Allow-Origin, there are many posts that will help.

---

<div class="post-metadata">

**Author:** ![greg2](http://forum.companieshouse.gov.uk/user_avatar/forum.companieshouse.gov.uk/greg2/32/593_2.png) [@greg2](http://forum.companieshouse.gov.uk/u/greg2)\
**Post date:** [July 3, 2018, 1:28pm UTC](http://forum.companieshouse.gov.uk/t/angular-local-dev-testing/1895/3 "2018-07-03T13:28:38Z")

</div>

Thanks Mark, I have done this and that is why I am confused.

I am running locally as [gregduffield.com:4200](http://gregduffield.com:4200) which is mapped to 127.0.0.1  
I have updated the API to allow [http://gregduffield.com:4200](http://gregduffield.com:4200) which I thought would then be the answer but I am still getting the CORS error. As CORS is defined on the Server I am not sure what else I can do to get this working locally at the moment?

Thanks

---

<div class="post-metadata">

**Author:** ![voracityemail](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/v/b77776/32.png) [@voracityemail](http://forum.companieshouse.gov.uk/u/voracityemail)\
**Post date:** [July 9, 2018, 2:44pm UTC](http://forum.companieshouse.gov.uk/t/angular-local-dev-testing/1895/4 "2018-07-09T14:44:41Z")

</div>

As far as localhost stuff goes the following should work (apologies if you read this already):

[http://forum.aws.chdev.org/t/allow-localhost-javascript-domain/83](http://forum.aws.chdev.org/t/allow-localhost-javascript-domain/83)

Maybe the ports part is confusing CH? I don’t know how ports work in the Companies House scheme of things when registering an api URL e.g. possibly the issue is the “:4200”. In the thread above it seems that what you need is:

> [@Allow localhost JavaScript domain?](http://ec2-34-244-67-204.eu-west-1.compute.amazonaws.com/t/allow-localhost-javascript-domain/83/2):
>
> the API expects a URL consisting of three parts, i.e. protocol, second-level and top-level domain. So [http://domain.domain](http://domain.domain)

If you have the possibility to, what happens if you try just using “localhost” and then as per:

> [@Allow localhost JavaScript domain?](http://ec2-34-244-67-204.eu-west-1.compute.amazonaws.com/t/allow-localhost-javascript-domain/83/12):
>
> editing /etc/hosts or its equivalent on your OS.
> 
> 192.168.0.1 localhost my.localdomain
> 
> And you can now register my.localdomain as a CH API “JavaScript domains”.
