Created
April 11, 2018 10:43
-
-
Save confraria/008d63ca939085b50e4d141776ae5738 to your computer and use it in GitHub Desktop.
sketch for single injectable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Client } from '@c8y/client'; | |
@Component() | |
class MyComponent() { | |
constructor(client: Client) {} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { NgModule, Injectable } from '@angular/core'; | |
import { Client, BasicAuth } from '@c8y/client'; | |
import { AppStateService } from './app-state.service'; | |
import { ManagedObjectResolver } from './resolvers'; | |
function clientFactory(auth) { | |
return new Client(auth); | |
} | |
@NgModule({ | |
imports: [], | |
exports: [], | |
declarations: [], | |
providers: [ | |
AppStateService, | |
ManagedObjectResolver, | |
InventoryService, | |
{ provide: BasicAuth, useValue: new BasicAuth() }, | |
{ provide: Client, useFactory: clientFactory, deps: [BasicAuth] } | |
] | |
}) | |
export class C8yDataModule {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment