Why do you want to do this in the route enter event handler?
You don't even use any information from the route or the event.
You could just register the UserService
with your Module an let it inject to your UserController
.
class MyAppModule extends Module {
MyAppModule() {
type(UsersService);
}
}
@NgController(
selector: '[users-controller]',
publishAs: 'userCtrl'
)
class UsersController {
var list;
UsersService _usersService;
UsersController(this._usersService) {
_userService.all((HttpResponse response){
var data = response.data['body'];
print(data);
}
}