Angular 4 HttpClient Query Parameters

I have been looking for a way to pass query parameters into an API call with the new HttpClientModule‘s HttpClient and have yet to find a solution. With the old Http module you would write something like this. getNamespaceLogs(logNamespace) { // Setup log namespace query parameter let params = new URLSearchParams(); params.set(‘logNamespace’, logNamespace); this._Http.get(`${API_URL}/api/v1/data/logs`, { … Read more

How to extend / inherit components?

I would like to create extensions for some components already deployed in Angular 2, without having to rewrite them almost completely, as the base component could undergo changes and wish these changes were also reflected in its derived components. I created this simple example to try to explain better my questions: With the following base … Read more

How to use a typescript enum value in an Angular2 ngSwitch statement

The Typescript enum seems a natural match with Angular2’s ngSwitch directive. But when I try to use an enum in my component’s template, I get “Cannot read property ‘xxx’ of undefined in …”. How can I use enum values in my component template? Please note that this is different from how to create html select … Read more

What are the practical differences between template-driven and reactive forms?

I have been reading about Angular2 new Forms API and it seems that there are two approaches on forms, one is Template driven forms other is reactive or model-driven forms. I would like to know the practical difference between the two, not the difference in syntax (obviously) but practical uses and which approach benefits more … Read more

Is there a compatibility list for Angular / Angular-CLI and Node.js?

I periodically run into the problem, having to spin up old Angular projects with deprecated dependencies of Angular. Because I unsually run the latest Node.js version (at least lates LTS version) I often had the problem, that I wasn’t able to get the old projects running. I solved this by using a node version manager, … Read more

Angular 2 ‘component’ is not a known element

I’m trying to use a component I created inside the AppModule in other modules. I get the following error though: “Uncaught (in promise): Error: Template parse errors: ‘contacts-box’ is not a known element: If ‘contacts-box’ is an Angular component, then verify that it is part of this module. If ‘contacts-box’ is a Web Component then … Read more

‘Found the synthetic property @panelState. Please include either “BrowserAnimationsModule” or “NoopAnimationsModule” in your application.’

I upgraded an Angular 4 project using angular-seed and now get the error Found the synthetic property @panelState. Please include either “BrowserAnimationsModule” or “NoopAnimationsModule” in your application. How can I fix this? What exactly is the error message telling me? 14 Answers 14

Angular 2+ and debounce

In AngularJS I was able to debounce a model by using ng-model options. ng-model-options=”{ debounce: 1000 }” How can I debounce a model in Angular? I tried to search for debounce in the docs but I couldn’t find anything. https://angular.io/search/#stq=debounce&stp=1 A solution would be to write my own debounce function, for example: import {Component, Template, … Read more