{"id":6617,"date":"2022-11-02T12:09:31","date_gmt":"2022-11-02T11:09:31","guid":{"rendered":"https:\/\/www.angulararchitects.io\/?p=6617"},"modified":"2022-11-02T12:09:31","modified_gmt":"2022-11-02T11:09:31","slug":"the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors","status":"publish","type":"post","link":"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/","title":{"rendered":"The Refurbished HttpClient in Angular 15 &#8211; Standalone APIs and Functional Interceptors"},"content":{"rendered":"<div class=\"wp-post-series-box series-angulars-future-without-ngmodules wp-post-series-box--expandable\">\n\t\t\t<input id=\"collapsible-series-angulars-future-without-ngmodules69d18be485f8b\" class=\"wp-post-series-box__toggle_checkbox\" type=\"checkbox\">\n\t\n\t<label\n\t\tclass=\"wp-post-series-box__label\"\n\t\t\t\t\tfor=\"collapsible-series-angulars-future-without-ngmodules69d18be485f8b\"\n\t\t\ttabindex=\"0\"\n\t\t\t\t>\n\t\t<p class=\"wp-post-series-box__name wp-post-series-name\">\n\t\t\tThis is post 6 of 8 in the series <em>&ldquo;Angular&#039;s Future with Standalone Components&rdquo;<\/em>\t\t<\/p>\n\t\t\t<\/label>\n\n\t\t\t<div class=\"wp-post-series-box__posts\">\n\t\t\t<ol>\n\t\t\t\t\t\t\t\t\t<li><a href=\"https:\/\/www.angulararchitects.io\/en\/blog\/angulars-future-without-ngmodules-lightweight-solutions-on-top-of-standalone-components\/\">Angular&#8217;s Future Without NgModules &#8211; Part 1: Lightweight Solutions Using Standalone Components<\/a><\/li>\n\t\t\t\t\t\t\t\t\t<li><a href=\"https:\/\/www.angulararchitects.io\/en\/blog\/angulars-future-without-ngmodules-part-2-what-does-that-mean-for-our-architecture\/\">Angular&#8217;s Future Without NgModules &#8211; Part 2: What Does That Mean for Our Architecture?<\/a><\/li>\n\t\t\t\t\t\t\t\t\t<li><a href=\"https:\/\/www.angulararchitects.io\/en\/blog\/4-ways-to-prepare-for-angulars-upcoming-standalone-components\/\">4 Ways to Prepare for Angular&#8217;s Upcoming Standalone Components<\/a><\/li>\n\t\t\t\t\t\t\t\t\t<li><a href=\"https:\/\/www.angulararchitects.io\/en\/blog\/routing-and-lazy-loading-with-standalone-components\/\">Routing and Lazy Loading with Angular&#8217;s Standalone Components<\/a><\/li>\n\t\t\t\t\t\t\t\t\t<li><a href=\"https:\/\/www.angulararchitects.io\/en\/blog\/angular-elements-web-components-with-standalone-components\/\">Angular Elements: Web Components with Standalone Components<\/a><\/li>\n\t\t\t\t\t\t\t\t\t<li><span class=\"wp-post-series-box__current\">The Refurbished HttpClient in Angular 15 &#8211; Standalone APIs and Functional Interceptors<\/span><\/li>\n\t\t\t\t\t\t\t\t\t<li><a href=\"https:\/\/www.angulararchitects.io\/en\/blog\/testing-angular-standalone-components\/\">Testing Angular Standalone Components<\/a><\/li>\n\t\t\t\t\t\t\t\t\t<li><a href=\"https:\/\/www.angulararchitects.io\/en\/blog\/tutorial-automatically-migrating-to-standalone-components-in-3-steps\/\">Automatic Migration to Standalone Components in 3 Steps<\/a><\/li>\n\t\t\t\t\t\t\t<\/ol>\n\t\t<\/div>\n\t<\/div>\n<p>Without any doubt, the <code>HttpClient<\/code> is one of the best-known services included in Angular. For version 15, the Angular team has now adapted it for the new standalone components. On this occasion, the interceptor concept was also revised.<\/p>\n<p>In this article, I will describe these innovations. <\/p>\n<p>\ud83d\udcc2 <a href=\"https:\/\/github.com\/manfredsteyer\/standalone-example-cli.git\">Source Code<\/a><\/p>\n<h2>Standalone APIs for HttpClient<\/h2>\n<p>Beginning with version 15, there <code>HttpClient<\/code> can be setup without any reference to the <code>HttpClientModule<\/code>. Instead, we can use <code>provideHttpClient<\/code> when bootstrapping our application:<\/p>\n<pre><code class=\"language-typescript\">import { provideHttpClient, withInterceptors } from &quot;@angular\/common\/http&quot;;\n\n[...]\n\nbootstrapApplication(AppComponent, {\n    providers: [\n        provideHttpClient(\n            withInterceptors([authInterceptor]),\n        ),\n    ]\n});<\/code><\/pre>\n<p>This new function also enables optional features of the <code>HttpClient<\/code>. Each feature has its own function. For example, the <code>withInterceptors<\/code> function enables support for Http Interceptors.<\/p>\n<p>The combination of a <code>provideXYZ<\/code> function and several optional <code>withXYZ<\/code> functions is not chosen arbitrarily here but corresponds to a pattern that the Angular team generally provides for standalone APIs. Application developers must therefore be on the lookout for functions that start with <code>provide<\/code> or <code>with<\/code> when setting up a new library.<\/p>\n<p>Also, this pattern leads to a very pleasant side effect: libraries become more tree-shakable. This is because a static source code analysis makes it very easy to find out whether the application ever calls a function. In the case of methods, this is not so easy due to the possibility of polymorphic use of the underlying objects.<\/p>\n<h2>Functional Interceptors<\/h2>\n<p>When introducing standalone APIs, the Angular team also took the opportunity and revised the <code>HttpClient<\/code> a bit. One result of this are the new functional interceptors. They allow interceptors to be expressed as simple functions. A separate service that implements a predefined interface is no longer necessary:<\/p>\n<pre><code class=\"language-typescript\">import { HttpInterceptorFn } from &quot;@angular\/common\/http&quot;;\nimport { tap } from &quot;rxjs&quot;;\n\nexport const authInterceptor: HttpInterceptorFn = (req, next) =&gt; {\n\n    console.log(&#039;request&#039;, req.method, req.url);\n    console.log(&#039;authInterceptor&#039;)\n\n    if (req.url.startsWith(&#039;https:\/\/demo.angulararchitects.io\/api\/&#039;)) {\n\n        \/\/ Setting a dummy token for demonstration\n\n        constheaders = req.headers.set(&#039;Authorization&#039;, &#039;Bearer Auth-1234567&#039;);\n\n        req = req.clone({\n            headers\n        });\n\n    }\n\n    return next(req).pipes(\n        tap(resp =&gt; console.log(&#039;response&#039;, resp))\n    );\n\n}<\/code><\/pre>\n<p>The interceptor shown adds an exemplary security token to HTTP calls that are directed to specific URLs. Except that the interceptor is now a function of type <code>HttpInterceptorFn<\/code>, the basic functionality of this concept has not changed. As shown above, functional interceptors can be set up using <code>withInterceptors<\/code> when calling <code>provideHttpClient<\/code> .<\/p>\n<h2>Interceptors and Lazy Loading<\/h2>\n<p>Interceptors in lazy modules have always led to confusion: As soon as a lazy module introduces its own interceptors, those of outer scopes \u2013 e.g. the root scope \u2013 are no longer triggered.<\/p>\n<p>Even if modules with standalone components and APIs are a thing of the past, the basic problem remains, especially since (lazy) route configurations can now set up their own services:<\/p>\n<pre><code class=\"language-typescript\">export const FLIGHT_BOOKING_ROUTES: Routes = [{\n    paths: &#039;&#039;,\n    component: FlightBookingComponent,\n    providers: [\n        MyService,\n        provideState(bookingFeature),\n        provideEffects([BookingEffects])\n        provideHttpClient(\n            withInterceptors([bookingInterceptor]),\n            withRequestsMadeViaParent(),\n        ),\n    ],\n}];<\/code><\/pre>\n<p>These services correspond to those the application previously registered in lazy modules. Technically, Angular introduces its own injector whenever such a <code>providers<\/code> array is available. This so-called environment injector defines a scope for the current route and its child routes.<\/p>\n<p>The new <code>provideHttpClient<\/code> function can also be used in this <code>providers<\/code> array to register interceptors for the respective lazy part of the application. By default, the previously discussed rule applies: If there are interceptors in the current environment injector, Angular ignores the interceptors in outer scopes.<\/p>\n<p>Exactly this behavior can be changed with <code>withRequestsMadeViaParent<\/code>: This method causes Angular to also trigger interceptors in outer scopes.<\/p>\n<h2>Pitfall with withRequestsMadeViaParent<\/h2>\n<p>The discussed <code>withRequestsMadeViaParent<\/code> function comes with a non-obvious pitfall: a root-scope service is unaware of inner scope and the interceptors registered there. It always accesses the <code>HttpClient<\/code> in the root scope and therefore only the interceptors set up there are executed:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/11\/scopes-interceptor.png\" alt=\"Interceptors in multiple scopes\" \/><\/p>\n<p>To solve this problem, the application could also register the outer service in the <code>providers<\/code> array of the route configuration and thus in the inner scope.<\/p>\n<p>In general, however, it seems to be very difficult to keep track of such constellations. Therefore, it might make sense to do without interceptors in inner scopes altogether. As an alternative, a very generic interceptor in the root scope could be used. Such an interceptor may even load additional logic with a dynamic <code>import<\/code> from lazy applications parts.<\/p>\n<h2>Legacy Interceptors and Other Features<\/h2>\n<p>While the new functional interceptors are very charming, applications can still take advantage of the original class-based interceptors. This option can be enabled using the <code>withLegacyInterceptors feature<\/code>. Then, the class-based interceptors are to be registered as usual via a multi-provider:<\/p>\n<pre><code class=\"language-typescript\">bootstrapApplication(AppComponent, {\n    providers: [\n        provideHttpClient(\n            withInterceptors([authInterceptor]),\n            withLegacyInterceptors(),\n        ),\n        {\n            provide: HTTP_INTERCEPTORS,\n            useClass: LegacyInterceptor,\n            multiple: true,\n        },\n    ]\n});<\/code><\/pre>\n<h2>Further Features<\/h2>\n<p>The <code>HttpClient<\/code> has some additional features that can also be activated using <code>with-<\/code>functions: <code>withJsonpSupport<\/code>, for example, activates support for JSONP, and <code>withXsrfConfiguration<\/code> configures details on the use of XSRF tokens. If the application does not call <code>withXsrfConfiguration<\/code>, default settings are used. However, to completely disable the use of XSRF tokens, call <code>withNoXsrfProtection<\/code>.<\/p>\n<h2>Summary<\/h2>\n<p>The revised <code>HttpClient<\/code> now wonderfully harmonizes with standalone components and associated concepts such as environment injectors. The Angular team also took the opportunity to revise the interceptors: They can now be implemented in the form of simple functions. In addition, it is now also possible to consider interceptors in outer scopes.<\/p>\n<h2>More on Standalone Components?<\/h2>\n<p>Learn all about Standalone Components in our free eBook:<\/p>\n<ul>\n<li>The mental model behind Standalone Components<\/li>\n<li>Migration scenarios and compatibility with existing code<\/li>\n<li>Standalone Components and the router and lazy loading<\/li>\n<li>Standalone Components and Web Components<\/li>\n<li>Standalone Components and DI and NGRX<\/li>\n<\/ul>\n<p>Please find our eBook here:<\/p>\n<p><a href=\"https:\/\/www.angulararchitects.io\/standalone-book\"><img decoding=\"async\" src=\"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/10\/title-page-small.jpg\" alt=\"free ebook\"><\/a><\/p>\n<p>Feel free to <a href=\"https:\/\/www.angulararchitects.io\/standalone-book\">download it here<\/a> now!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Angular team has adapted the HttpClient for the new standalone components. On this occasion, the interceptor concept was also revised.<\/p>\n","protected":false},"author":9,"featured_media":6622,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_price":"","_stock":"","_tribe_ticket_header":"","_tribe_default_ticket_provider":"","_ticket_start_date":"","_ticket_end_date":"","_tribe_ticket_show_description":"","_tribe_ticket_show_not_going":false,"_tribe_ticket_use_global_stock":"","_tribe_ticket_global_stock_level":"","_global_stock_mode":"","_global_stock_cap":"","_tribe_rsvp_for_event":"","_tribe_ticket_going_count":"","_tribe_ticket_not_going_count":"","_tribe_tickets_list":"[]","_tribe_ticket_has_attendee_info_fields":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6617","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-unkategorisiert","post_series-angulars-future-without-ngmodules"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>The Refurbished HttpClient in Angular 15 - Standalone APIs and Functional Interceptors - ANGULARarchitects<\/title>\n<meta name=\"description\" content=\"The Angular team has adapted the HttpClient for the new standalone components. On this occasion, the interceptor concept was also revised.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The Refurbished HttpClient in Angular 15 - Standalone APIs and Functional Interceptors - ANGULARarchitects\" \/>\n<meta property=\"og:description\" content=\"The Angular team has adapted the HttpClient for the new standalone components. On this occasion, the interceptor concept was also revised.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/\" \/>\n<meta property=\"og:site_name\" content=\"ANGULARarchitects\" \/>\n<meta property=\"article:published_time\" content=\"2022-11-02T11:09:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/11\/sujet-fb.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Manfred Steyer, GDE\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/11\/sujet.jpg\" \/>\n<meta name=\"twitter:creator\" content=\"@daniel\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Manfred Steyer, GDE\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/\"},\"author\":{\"name\":\"Manfred Steyer, GDE\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#\/schema\/person\/15628efa7af4475ffaaeeb26c5112951\"},\"headline\":\"The Refurbished HttpClient in Angular 15 &#8211; Standalone APIs and Functional Interceptors\",\"datePublished\":\"2022-11-02T11:09:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/\"},\"wordCount\":797,\"publisher\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/11\/shutterstock-620676392.jpg\",\"articleSection\":[\"Unkategorisiert\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/\",\"url\":\"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/\",\"name\":\"The Refurbished HttpClient in Angular 15 - Standalone APIs and Functional Interceptors - ANGULARarchitects\",\"isPartOf\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/11\/shutterstock-620676392.jpg\",\"datePublished\":\"2022-11-02T11:09:31+00:00\",\"description\":\"The Angular team has adapted the HttpClient for the new standalone components. On this occasion, the interceptor concept was also revised.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/#primaryimage\",\"url\":\"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/11\/shutterstock-620676392.jpg\",\"contentUrl\":\"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/11\/shutterstock-620676392.jpg\",\"width\":1000,\"height\":668},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.angulararchitects.io\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The Refurbished HttpClient in Angular 15 &#8211; Standalone APIs and Functional Interceptors\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#website\",\"url\":\"https:\/\/www.angulararchitects.io\/en\/\",\"name\":\"ANGULARarchitects\",\"description\":\"AngularArchitects.io\",\"publisher\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.angulararchitects.io\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#organization\",\"name\":\"ANGULARarchitects\",\"alternateName\":\"SOFTWAREarchitects\",\"url\":\"https:\/\/www.angulararchitects.io\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2023\/07\/AA-Logo-RGB-horizontal-inside-knowledge-black.svg\",\"contentUrl\":\"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2023\/07\/AA-Logo-RGB-horizontal-inside-knowledge-black.svg\",\"width\":644,\"height\":216,\"caption\":\"ANGULARarchitects\"},\"image\":{\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/github.com\/angular-architects\",\"https:\/\/www.linkedin.com\/company\/angular-architects\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#\/schema\/person\/15628efa7af4475ffaaeeb26c5112951\",\"name\":\"Manfred Steyer, GDE\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.angulararchitects.io\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/a0b59539674d8b71ea1c1f4764b11244b5f499203f1d11b40f37d8f3f90be033?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/a0b59539674d8b71ea1c1f4764b11244b5f499203f1d11b40f37d8f3f90be033?s=96&d=mm&r=g\",\"caption\":\"Manfred Steyer, GDE\"},\"sameAs\":[\"https:\/\/x.com\/daniel\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"The Refurbished HttpClient in Angular 15 - Standalone APIs and Functional Interceptors - ANGULARarchitects","description":"The Angular team has adapted the HttpClient for the new standalone components. On this occasion, the interceptor concept was also revised.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/","og_locale":"en_US","og_type":"article","og_title":"The Refurbished HttpClient in Angular 15 - Standalone APIs and Functional Interceptors - ANGULARarchitects","og_description":"The Angular team has adapted the HttpClient for the new standalone components. On this occasion, the interceptor concept was also revised.","og_url":"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/","og_site_name":"ANGULARarchitects","article_published_time":"2022-11-02T11:09:31+00:00","og_image":[{"width":1024,"height":630,"url":"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/11\/sujet-fb.jpg","type":"image\/jpeg"}],"author":"Manfred Steyer, GDE","twitter_card":"summary_large_image","twitter_image":"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/11\/sujet.jpg","twitter_creator":"@daniel","twitter_misc":{"Written by":"Manfred Steyer, GDE","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/#article","isPartOf":{"@id":"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/"},"author":{"name":"Manfred Steyer, GDE","@id":"https:\/\/www.angulararchitects.io\/en\/#\/schema\/person\/15628efa7af4475ffaaeeb26c5112951"},"headline":"The Refurbished HttpClient in Angular 15 &#8211; Standalone APIs and Functional Interceptors","datePublished":"2022-11-02T11:09:31+00:00","mainEntityOfPage":{"@id":"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/"},"wordCount":797,"publisher":{"@id":"https:\/\/www.angulararchitects.io\/en\/#organization"},"image":{"@id":"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/#primaryimage"},"thumbnailUrl":"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/11\/shutterstock-620676392.jpg","articleSection":["Unkategorisiert"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/","url":"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/","name":"The Refurbished HttpClient in Angular 15 - Standalone APIs and Functional Interceptors - ANGULARarchitects","isPartOf":{"@id":"https:\/\/www.angulararchitects.io\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/#primaryimage"},"image":{"@id":"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/#primaryimage"},"thumbnailUrl":"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/11\/shutterstock-620676392.jpg","datePublished":"2022-11-02T11:09:31+00:00","description":"The Angular team has adapted the HttpClient for the new standalone components. On this occasion, the interceptor concept was also revised.","breadcrumb":{"@id":"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/#primaryimage","url":"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/11\/shutterstock-620676392.jpg","contentUrl":"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2022\/11\/shutterstock-620676392.jpg","width":1000,"height":668},{"@type":"BreadcrumbList","@id":"https:\/\/www.angulararchitects.io\/en\/blog\/the-refurbished-httpclient-in-angular-15-standalone-apis-and-functional-interceptors\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.angulararchitects.io\/en\/"},{"@type":"ListItem","position":2,"name":"The Refurbished HttpClient in Angular 15 &#8211; Standalone APIs and Functional Interceptors"}]},{"@type":"WebSite","@id":"https:\/\/www.angulararchitects.io\/en\/#website","url":"https:\/\/www.angulararchitects.io\/en\/","name":"ANGULARarchitects","description":"AngularArchitects.io","publisher":{"@id":"https:\/\/www.angulararchitects.io\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.angulararchitects.io\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.angulararchitects.io\/en\/#organization","name":"ANGULARarchitects","alternateName":"SOFTWAREarchitects","url":"https:\/\/www.angulararchitects.io\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.angulararchitects.io\/en\/#\/schema\/logo\/image\/","url":"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2023\/07\/AA-Logo-RGB-horizontal-inside-knowledge-black.svg","contentUrl":"https:\/\/www.angulararchitects.io\/wp-content\/uploads\/2023\/07\/AA-Logo-RGB-horizontal-inside-knowledge-black.svg","width":644,"height":216,"caption":"ANGULARarchitects"},"image":{"@id":"https:\/\/www.angulararchitects.io\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/github.com\/angular-architects","https:\/\/www.linkedin.com\/company\/angular-architects\/"]},{"@type":"Person","@id":"https:\/\/www.angulararchitects.io\/en\/#\/schema\/person\/15628efa7af4475ffaaeeb26c5112951","name":"Manfred Steyer, GDE","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.angulararchitects.io\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/a0b59539674d8b71ea1c1f4764b11244b5f499203f1d11b40f37d8f3f90be033?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a0b59539674d8b71ea1c1f4764b11244b5f499203f1d11b40f37d8f3f90be033?s=96&d=mm&r=g","caption":"Manfred Steyer, GDE"},"sameAs":["https:\/\/x.com\/daniel"]}]}},"_links":{"self":[{"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/posts\/6617","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/comments?post=6617"}],"version-history":[{"count":0,"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/posts\/6617\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/media\/6622"}],"wp:attachment":[{"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/media?parent=6617"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/categories?post=6617"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.angulararchitects.io\/en\/wp-json\/wp\/v2\/tags?post=6617"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}