I am currently attempting to utilize a service created by another individual (github).
This particular service requires a configuration to be passed to it. As stated in the repository:
To configure Neo4jSettings in your bootstrap:
provide('Neo4jSettings', {useValue: {
endpoint: 'http://localhost:7474',
username: 'neo4j',
password: 'neo4j42'
}})
To be honest, I am unsure of how to proceed with this information as injecting settings into a service is unfamiliar territory based on the tutorials I have followed. My attempts at finding a solution through Google were not very fruitful.
Thus far, I have added the service to my module home.module.ts
:
@NgModule({
imports: [CommonModule],
declarations: [HomeComponent],
exports: [HomeComponent],
providers: [Neo4jService] // Included here
})
export class HomeModule {}
And in my component, home.component.ts
:
@Component({
moduleId: module.id,
selector: 'vs-home',
providers: [Neo4jService], // also added here
templateUrl: 'home.component.html'
})
export class HomeComponent implements OnInit {
constructor(private Neo4jService: Neo4jService) {} // and here as well
}
As expected, when running my application, I encounter the following error:
No provider for Neo4jSettings!
My query revolves around how to provide an object to a service? Specifically, the Neo4jSettings
.