Skip to content

Commit a8b5d35

Browse files
authored
docs: added TypeDI service decorator to example in README (#643)
1 parent 712662e commit a8b5d35

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,13 +1402,16 @@ That's it, now you can inject your services into your controllers:
14021402

14031403
```typescript
14041404
@Controller()
1405+
@Service()
14051406
export class UsersController {
14061407
constructor(private userRepository: UserRepository) {}
14071408

14081409
// ... controller actions
14091410
}
14101411
```
14111412

1413+
Note: As TypeDI@0.9.0 won't create instances for unknown classes, you have to decorate your Controller as a `Service()` as well. See [#642](https://github.com/typestack/routing-controllers/issues/642)
1414+
14121415
For other IoC providers that don't expose a `get(xxx)` function, you can create an IoC adapter using `IocAdapter` like so:
14131416

14141417
```typescript

0 commit comments

Comments
 (0)