1
var AddCtrl = function($scope, $stateParams, $http, Revision, Article, $location) {

    $scope.create = function() {
        if ($scope.article) {
            $scope.revision={};
            Article.create($scope.article, function(data, headers){
                angular.copy($scope.article, $scope.revision);
                $scope.revision.article_id = data.id;
                $scope.revision.content = data.content;
                $scope.revision.title = data.title;
                Revision.create($scope.revision);
                $location.path('#/wiki/revision/'+$scope.revision.article_id);
            });
        }

        if ($scope.revision && $stateParams.id) {
            $scope.revision.article_id = $stateParams.id;
            Revision.create($scope.revision);
        }
    };

};

This is what my controller for adding a post looks like and I'd like to redirect the person to the newly created post. Trouble is - $location.path redirects me to #/home (index page) every time I try this.

I have tried putting in hard coded links and that didn't work out either. What is wrong with my code and what can I do to mend it?

1
  • Try to remove the #. Commented Nov 22, 2013 at 13:41

1 Answer 1

1

You dont need the "#" actually. That's probably all. ( link to doc )

Sign up to request clarification or add additional context in comments.

2 Comments

Well that sure was an easy fix. Thanks, mate!
I'm having a similar problem, expect removing the # is not working for me, Please help stackoverflow.com/questions/24791938/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.