更加简便的注入方法,不用事先声明及使用this来赋值
This commit is contained in:
parent
4ee0b7210b
commit
71a16606db
|
@ -5,12 +5,8 @@ import { DemoService } from './providers/demo/demo.service'
|
|||
|
||||
@Controller('posts')
|
||||
export class PostsController {
|
||||
private readonly demoService;
|
||||
|
||||
constructor(demoService: DemoService) {
|
||||
this.demoService = demoService
|
||||
}
|
||||
|
||||
constructor(private readonly demoService: DemoService) {}
|
||||
|
||||
@Get()
|
||||
index() {
|
||||
|
|
Loading…
Reference in New Issue