Skip to content

Commit 79e7e22

Browse files
authored
Merge pull request #96 from karnavpargi/patch-1
Added angular v18 service import example
2 parents 9a21af1 + 514d492 commit 79e7e22

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,22 @@
594594
console.log(myService); // MyService
595595
}
596596
}
597+
598+
// Angular v18 and above
599+
600+
import { Component, inject } from '@angular/core';
601+
import { MyService } from './my-service';
602+
603+
@Component({
604+
selector: 'my-component',
605+
template: '<div>Parameter decorator</div>'
606+
})
607+
export class MyComponent {
608+
myService: MyService = inject(MyService)
609+
constructor() {
610+
console.log(myService); // MyService
611+
}
612+
}
597613
```
598614
**[⬆ Back to Top](#table-of-contents)**
599615

0 commit comments

Comments
 (0)