Skip to content

http DI example not using root injector #357

@yringler

Description

@yringler

Several times at https://docs.nativescript.org/angular/ng-framework-modules/http, it is made clear that

Note that the services should be explicitly declared in providers

There are other ways to do DI in angular, notably

@Injectable({
  providedIn: 'root',
})
export class MyAwesomeDataService{
  // Service code...
}

or specifying an NgModule in the provided in option.

Are these also ok?
If they are ok, the documentation should be less "opinionated" in tone, and if it's not ok (or just not reccomended) the docs should say why.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions