简体   繁体   English

angularjs服务调用$ location.path是否违反最佳实践?

[英]angularjs service calling $location.path is it against best practices?

I am using a service in angularJS where I call $location.path inside one method in order to make a route change after a success or failure response from another service internally. 我在angularJS中使用一种服务,在该服务中我在一个方法内调用$location.path ,以便在内部从另一个服务获得成功或失败响应后进行路由更改。 Is this against Angular's best practices? 这是否违反了Angular的最佳做法?

根据其他成员提供的输入,在服务内部调用$location.path违反了Angular的最佳做法,而应在控制器中调用。

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

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