You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-1
Original file line number
Diff line number
Diff line change
@@ -117,7 +117,7 @@ npm i angular-oauth2-oidc --save
117
117
If you use Standalone Components introduced with Angular 14, you can use our standalone API (call to ``provideOAuthClient``) in your ``main.ts`` to setup the ``OAuthClient``:
As Angular 14 does have Standalone Components but no Standalone API for its ``HttpClient``, you need to go with the traditional ``HttpClientModule`` in this version:
The ``provideOAuthClient`` function takes the same parameters as the forRoot function of the OAuthModule that is still in place for the sake of compatibility with existing code bases.
<div><preclass="line-numbers"><codeclass="language-sh">npm i angular-oauth2-oidc --save</code></pre></div><h2id="option-1-standalone-apis">Option 1: Standalone APIs</h2>
124
124
<p>If you use Standalone Components introduced with Angular 14, you can use our standalone API (call to <code>provideOAuthClient</code>) in your <code>main.ts</code> to setup the <code>OAuthClient</code>:</p>
});</code></pre></div><p>As Angular 14 does have Standalone Components but no Standalone API for its <code>HttpClient</code>, you need to go with the traditional <code>HttpClientModule</code> in this version:</p>
139
+
<div><preclass="line-numbers"><codeclass="language-TypeScript">// main.ts -- Angular 14 version
140
+
import { bootstrapApplication } from '@angular/platform-browser';
141
+
142
+
import { HttpClientModule } from '@angular/common/http';
143
+
144
+
import { AppComponent } from './app/app.component';
145
+
import { provideOAuthClient } from 'angular-oauth2-oidc';
146
+
import { importProvidersFrom } from '@angular/core';
147
+
148
+
bootstrapApplication(AppComponent, {
149
+
providers: [
150
+
importProvidersFrom(HttpClientModule),
151
+
provideOAuthClient()
152
+
]
138
153
});</code></pre></div><p>The <code>provideOAuthClient</code> function takes the same parameters as the forRoot function of the OAuthModule that is still in place for the sake of compatibility with existing code bases.</p>
139
154
<h2id="option-2-using-ngmodules">Option 2: Using NgModules</h2>
140
155
<div><preclass="line-numbers"><codeclass="language-TypeScript">import { HttpClientModule } from '@angular/common/http';
0 commit comments