Cors error when i access to a JSON local file

i’m getting a error when i trying to access to a local JSON file. This is my function to bring the data from the json.

        $scope.getJSON = function () {
        (self.servicioObj = jsonFactory.GetJson('data.json')).then(
                function (dataResponse) {
                    $scope.datosJson = [];
                    $scope.datosJson =;
                }, function (error) {

And this is my Factory code.

    function jsonFactory($http, $q) {

    var self = this;

    self.urlBase = '';
    self.jsonFactory = {};
    self.tiempoEspera = 120000;
    self.jsonFactory.GetJson = function (metodo) {
        var tiempo = $q.defer();
        var url = self.urlBase + metodo;
        var peticion = $http({
            method: 'get',
            url: url,
            headers: {'Access-Control-Allow-Origin': '*'},
            cache: false,
            timeout: tiempo.promise
      return self.jsonFactory;

When i call the getJSON function i get this error message.

XMLHttpRequest cannot load No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8383' is therefore not allowed access.

I dont know why i’m getting this error if i put in the urlBase localhost instead of i can access to the JSON file without any problem

Source: AngularJS