Http post in angulare Js cross origen blocked


Hi All,
i am developing simple login form for mobile app and i am new to this ionic
Same post method working through fiddler and not working from ionic angular cross origen blocked error throwing where i need set properties.

Please check the below code.

.controller(‘LoginCtrl’, function ($scope, $http) {
$scope.login = function (user) {
var userdetails = { grant_type: “password”, username: user.username, password: user.password };

        url: user.url + "/Token",
        method: "POST",
        data: userdetails,
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    }).success(function (data, status, headers, config) {
    }).error(function (data, status, headers, config) {
        alert('error found');


Thanks inadvance
Janardana B



<?php header('Access-Control-Allow-Origin: *'); ?>

To your php file (if you are using php for the login process).


Have you tried setting $sce?

This is angular’s way of dealing with cross domain issues.$sce#getTrustedResourceUrl