如何在UI-Router状态的MyService
中将服务close()
注入功能onExit
?我在模块配置中使用UIRouterModule.forChild({ states: myStates })
import {MyComponent} from "../my.component";
import {MyService} from "../myservice";
export const myStates = [{
name: 'stateName1',
params: {
'uid': null
},
views: {
'stateName2' : {
component : MyComponent
}
},
resolve: [
{
token: 'data',
deps: [MyService],
resolveFn: resolveData
}
],
onExit: [close]
}];
export function close() {
MyService.close();
}