About 5,540,000 results
Open links in new tab
  1. angular - What does @Injectable mean? - Stack Overflow

    Sep 23, 2019 · Injectable () in the service specifies that this service can be injected/used in other components. In short if service has injectable decorator, other components can use that …

  2. Why do we use @Injectable () decorator , when we can actually …

    The @Injectable () decorator has the providedIn metadata option, where you can specify the provider of the decorated service class with the root injector, or with the injector for a specific …

  3. What is the difference between @Inject and @Injectable in …

    May 19, 2016 · The @Injectable decorator aims to actually set some metadata about which dependencies to inject into the constructor of the associated class. It's a class decorator that …

  4. node.js - What is Injectable in NestJS? - Stack Overflow

    Oct 14, 2020 · import { Injectable } from '@nestjs/common'; const userMock = [{ account: 'dung', password: '12345678' }]; @Injectable() export class UserService { getUser() { return userMock …

  5. ngOnInit not being called when Injectable class is Instantiated

    May 27, 2017 · 70 I don't know about all the lifecycle hooks, but as for destruction, ngOnDestroy actually get called on Injectable when it's provider is destroyed (for example an Injectable …

  6. typescript - What is the purpose of providedIn with the Injectable ...

    Jun 14, 2018 · Injectable is provided - an instance of the Injectable will be given to classes below this specific injector level, whenever they request it. Injectable is injected - a class constructor …

  7. Angular 19 - Why is a new @Injectable service created each time

    Jan 11, 2025 · The service is marked as @injectable. I then injected the service into a route guard component. The route guard gets an authentication service object from inject (). I expected …

  8. Inject a service requiring constructor parameter - Stack Overflow

    Aug 28, 2019 · import { APP_CONFIG, IAppConfig } from './app.config'; @Injectable() export class YourService { constructor(@Inject(APP_CONFIG) private config: IAppConfig) { // You can use …

  9. When do we need to use @Injectable on our services in Angular2?

    Dec 23, 2016 · The first paragraph sounds like the previous @Injectable documentation, while the second paragraph got it right. Just keep in mind that it is just recommended that we always …

  10. angular - Component as Injectable? - Stack Overflow

    Apr 8, 2016 · A component is injectable by default @Component() (or @Directive()) includes @Injectable(). Don't expect to get a specific instance of a component injected. This works for …