angularjs - How to pass parameter with ui-sref between deeply nested objects? -
as have nested object follow:
provider(providerid) =>> post (postid)=>> comment (commentid)=>> reply (replyid)
so, while in last step of reply can not pass providerid reply step.
here shown how works $stateparams in each steps.
here reply state.
$stateprovider .state('reply', { url: '/blog/providers/{providerid}/posts/{postid}/comments/{commentid}', templateurl: 'app/blog/provider/post/comment/reply/reply.html', controller: 'replyctrl' });
therefore can not pass parameter getting following error:
get http://localhost:9000/api/providers//posts/5551b281bcaa20002387fb31/comments/5551b3b4bcaa20002387fb32 404 (not found)
this have in comment.html, 1 step before reply in order pass parameter reply step. not sure how retrieve providerid in case don't have here.
<div ng-repeat="comment in post.comments track $index" > ....... <a ui-sref="reply({providerid: ..., postid : post._id, commentid: comment._id})"></a>
also inside replyctrl, can not access of variables have passed inside html , error got. added following lines inside replyctrl.
console.log('postid reply state' , postid); console.log('commentid reply state', commentid);
so received error.
referenceerror: postid not defined
is there in order guide me how pass parameter here.
this link :)
Comments
Post a Comment