简体   繁体   English

angularjs:如何获取spa应用程序中的当前页面/组件?

[英]angularjs: how can I get the current page/component in spa app?

I have a sidebar in spa with functions and I need to get the current page that the function called from. 我在spa中有一个带有功能的侧边栏,我需要获取调用该功能的当前页面。 any solution with angularjs? 任何与angularjs解决方案? maybe routing? 也许路由?

You can use the angular $location service for this purpose. 您可以为此使用角度$ location服务。

$location.path() , $location.absUrl() or $location.url() will satisfy you requirement. $location.path()$location.absUrl()$location.url()将满足您的要求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM