app.controller('indexController', ['$scope', '$http', function($scope, $http){

    $scope.currency = 'USD';
    $scope.codes = currencyCodes;

    $scope.handleCodeChange = function ($index) {
        $scope.currency = $scope.codes[$index];
        console.log($scope.currency);
    };

    $scope.toggleAdd = function () {
        $scope.shouldShowAdd = !$scope.shouldShowAdd;
        $('#addItem').slideToggle(300);
        console.log('Show pressed');
    };

    document.scope = $scope;

    $scope.formSubmit = function () {
        $scope.posting = true;
        $scope.formData = {_token: csrfToken, title: $scope.title, currency: $scope.currency, price: $scope.price};
        console.log($scope.formData);

        $http.post('/items', JSON.stringify($scope.formData))
            .success(function (data, status, headers, config) {
                console.log('the data to be sent is ' + JSON.stringify(data));
                $scope.responseData = data;
                console.log($scope.responseData);
                window.location = $scope.responseData.redirect_url;
                $scope.posting = false;
            })

            .error(function (data, status, headers, config) {
                console.log(data);
                $scope.posting = false;

            });
    };

}]);

@@ -1006,24 +1006,215 @@
 ponseData);%0A
+%0A                if (data.message) %7B%0A                    $scope.posting = false;%0A                    humane.log(data.message);%0A                %7D%0A%0A                if (data.redirect_url) %7B%0A    
             
@@ -1269,16 +1269,35 @@
 ct_url;%0A
+                %7D%0A%0A
         

Handle error message case on product create front end