Problem:
When adding (Visual Code autocompleted/-added) a variable (private _dataService: DataService
) in AppComponent constructor(…) { }
(because I used it down below) somehow the whole UI output vanishes.
When taken out of it (or moved above), all is fine.
Why?
Project is generated with Angular-CLI (no HTML customisations at this point).
View output with ng serve
.
import { Component } from '@angular/core';
import { DataService } from './services/DataService'
import { isType } from '@angular/core/src/type';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'app';
constructor(
private _dataService: DataService
// private translate: TranslateService
) { }
………
Angular CLI: 1.7.4 Node: 9.6.1 OS: darwin x64 Angular: 5.2.9
EDIT Just realised I forgot the DataService to the Component (like I also see you already commented) :P!
-->
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
providers: [DataService,Http]
})
But the Problem persists…
Console output:
Error: StaticInjectorError(AppModule)[Http -> ConnectionBackend]: StaticInjectorError(Platform: core)[Http -> ConnectionBackend]: NullInjectorError: No provider for ConnectionBackend!