How to destroy an angular factory instance
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: On the one hand, I have several factories where each factory controls a websocket. On the other hand, One of those factories should be started when client is logged, so: if(user.isLogged()){ $injector.get('NotificationsWebsocket') } That's the way I initialize my factory dinamically, the problem come up when the user logs out. I don't know how to delete an instance of angular instances factory or how to destroy the NotificationsWebsocket. I tried to close socket, but when I log in again, the socket doesn't connect because factory is not