No provider for HttpClient

To resolve this problem HttpClient is Angular’s mechanism for communicating with a remote server over HTTP. To make HttpClient available everywhere in the app, open the root AppModule, import the HttpClientModule from @angular/common/http,import { HttpClientModule } from ‘@angular/common/http’; add it to the @NgModule.imports array.imports:[HttpClientModule, ]

Error when trying to inject a service into an angular component “EXCEPTION: Can’t resolve all parameters for component”, why?

Import it from the file where it is declared directly instead of the barrel. I don’t know what exactly causes the issue but I saw it mentioned several times (probably some kind of circular dependency). It should also be fixable by changing the order of the exports in the barrel (don’t know details, but was … Read more

TypeScript sorting an array

The error is completely correct. As it’s trying to tell you, .sort() takes a function that returns number, not boolean. You need to return negative if the first item is smaller; positive if it it’s larger, or zero if they’re equal.

Uncaught ReferenceError: define is not defined typescript

Here your TypeScript has compiled happily, to code that will work in a requireJS environment (technically, an AMD environment). That means it generates output that assumes that define/require etc all already exist. The overall answer is that you need to include RequireJS before you depend on your compiled code. Notably the error suggests you’ve made … Read more

Angular2 Error: There is no directive with “exportAs” set to “ngForm”

Since 2.0.0.rc6: forms: deprecated provideForms() and disableDeprecatedForms() functions have been removed. Please import the FormsModule or the ReactiveFormsModule from @angular/forms instead. In short: If you use template-driven forms, add FormsModule to your @NgModule. If you use model-driven forms, add ReactiveFormsModule to your @NgModule. So, add to your app.module.ts or equivalent: Failing to have one of … Read more