0

Hello i have diffrents states for 1 controller. that looks like this:

        .state('new-orders', {
        url: "/new-orders",
        templateUrl: "views/new-orders.html",
        controller: 'OrderCtrl',
        cache: false
    })

    .state('view-order', {
        url: "/view-order/:orderid",
        templateUrl: "views/view-order.html",
        controller: 'OrderCtrl',
        cache: false
    })

    .state('open-orders', {
        url: "/open-orders",
        templateUrl: "views/open-orders.html",
        controller: 'OrderCtrl',
        cache: false
    })

    .state('completed-orders', {
        url: "/completed-orders",
        templateUrl: "views/completed-orders.html",
        controller: 'OrderCtrl',
        cache: false
    });

now when a user is in state new-orders, a user can open a order. I do so using:

    $scope.goToOrder = function(orderid) {
    $state.go('view-order/:orderid/',{orderid:orderid});
    }

but for some reason when goToOrder is called i get this response:

Error: Could not resolve 'view-order/:orderid/' from state 'new-orders'

1 Answer 1

1

$state.go accept a state name not a url.

Try this:

$scope.goToOrder = function(orderid) {
    $state.go('view-order',{orderid:orderid});
}
Sign up to request clarification or add additional context in comments.

Comments

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.