Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Added angular v18 service import example
  • Loading branch information
karnavpargi authored Jan 21, 2025
1 parent 9a21af1 commit 514d492
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,22 @@
console.log(myService); // MyService
}
}
// Angular v18 and above
import { Component, inject } from '@angular/core';
import { MyService } from './my-service';
@Component({
selector: 'my-component',
template: '<div>Parameter decorator</div>'
})
export class MyComponent {
myService: MyService = inject(MyService)
constructor() {
console.log(myService); // MyService
}
}
```
**[⬆ Back to Top](#table-of-contents)**
Expand Down

0 comments on commit 514d492

Please sign in to comment.