If you are using Node.js + Express for example, you need to do this:
/**
> * Enabling CORS
> */
> app.all('/*', function(req, res, next) {
> res.header('Access-Control-Allow-Origin', req.headers.origin ||
> "*");
> res.header('Access-Control-Allow-Methods',
> 'GET,POST,PUT,HEAD,DELETE,OPTIONS');
> res.header('Access-Control-Allow-Headers',
> 'content-Type,x-requested-with');
> next();
> });
On Thu, Apr 9, 2015 at 1:55 PM, Rafael Bernard Rodrigues Araujo <
[email protected]> wrote:
> Alessandro, the solution depends on your backend language. Yesterday I was
> enabling CORS for PHP. My code:
>
> ===
> header("Access-Control-Allow-Origin: *");
> ===
>
> I put a wildcard "*" for my API.
>
> --
> Rafael Bernard Rodrigues Araújo
> about.me/rafaelbernard
> Analista de Tecnologia | Hospedagem de sites - http://oservidor.com
>
> On Thu, Apr 9, 2015 at 12:12 PM, Alessandro <
> [email protected]> wrote:
>
>> I write my webApp that use tha angularJs and it send a request to server
>> for return Json!
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>
--
Samuel Castro
Full Stack Developer
(37) 9110-8850
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.