0

I'm new to Angular. I'm trying to post a tag under a BlogPost.

Here's what I started with (Angularjs Service):

angular.module('app.tags').factory("Tags", ['$resource', function($resource) {
    return $resource('posts/:postID/tags/:tagId', {
        tagId: '@_id',
        postID: // Post ID?
    }, {
        update: {
            method: 'PUT'
        }
    });
}]);

How would I get the postID to match up with my Post's ID?

1 Answer 1

1

Documented with $route service the current.params object holds all of the current route parameters.

$route.current.params

So, you can address postId by injecting $route and asking for:

$route.current.params.postId
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.