@angular/fire 17.1.0-canary.1302e3a → 17.1.0-canary.58e6c3b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/docs/analytics.md +17 -29
- package/docs/app-check.md +17 -13
- package/docs/auth.md +44 -9
- package/docs/database.md +13 -13
- package/docs/firestore.md +23 -24
- package/docs/functions.md +15 -12
- package/docs/messaging.md +30 -8
- package/docs/performance.md +14 -16
- package/docs/remote-config.md +14 -12
- package/docs/storage.md +12 -11
- package/docs/vertexai.md +53 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -190,4 +190,14 @@ import { } from '@angular/fire/app-check';
|
|
|
190
190
|
```
|
|
191
191
|
</td>
|
|
192
192
|
</tr>
|
|
193
|
+
<tr>
|
|
194
|
+
<td>
|
|
195
|
+
|
|
196
|
+
#### [Vertex AI](docs/vertexai.md#vertex-ai-preview)
|
|
197
|
+
```ts
|
|
198
|
+
import { } from '@angular/fire/vertexai-preview';
|
|
199
|
+
```
|
|
200
|
+
</td>
|
|
201
|
+
|
|
202
|
+
</tr>
|
|
193
203
|
</table>
|
package/docs/analytics.md
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
Google Analytics is an app measurement solution, available at no charge, that provides insight on app usage and user engagement.
|
|
10
10
|
|
|
11
11
|
[Learn more](https://firebase.google.com/docs/analytics)
|
|
12
|
+
|
|
12
13
|
## Dependency Injection
|
|
13
14
|
|
|
14
15
|
As a prerequisite, ensure that `AngularFire` has been added to your project via
|
|
@@ -16,52 +17,39 @@ As a prerequisite, ensure that `AngularFire` has been added to your project via
|
|
|
16
17
|
ng add @angular/fire
|
|
17
18
|
```
|
|
18
19
|
|
|
19
|
-
Provide a
|
|
20
|
+
Provide a Analytics instance in the application's `app.config.ts`:
|
|
20
21
|
|
|
21
22
|
```ts
|
|
22
|
-
@
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
|
|
24
|
+
import { provideAnalytics, getAnalytics } from '@angular/fire/analytics';
|
|
25
|
+
|
|
26
|
+
export const appConfig: ApplicationConfig = {
|
|
27
|
+
providers: [
|
|
28
|
+
provideFirebaseApp(() => initializeApp({ ... })),
|
|
29
|
+
provideAnalytics(() => getAnalytics()),
|
|
27
30
|
...
|
|
28
|
-
// App initialization
|
|
29
|
-
provideFirebaseApp(() => initializeApp(environment.firebase)),
|
|
30
|
-
provideAnalytics(() => getAnalytics())
|
|
31
31
|
],
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
})
|
|
35
|
-
export class AppModule { }
|
|
32
|
+
...,
|
|
33
|
+
}
|
|
36
34
|
```
|
|
37
35
|
|
|
38
|
-
|
|
36
|
+
Next inject `Analytics` into your component:
|
|
39
37
|
|
|
40
38
|
```typescript
|
|
41
39
|
import { Component, inject } from '@angular/core';
|
|
42
40
|
import { Analytics } from '@angular/fire/analytics';
|
|
43
41
|
|
|
44
|
-
@Component({
|
|
45
|
-
standalone: true,
|
|
46
|
-
selector: 'app-user-profile',
|
|
47
|
-
...
|
|
48
|
-
})
|
|
42
|
+
@Component({ ... })
|
|
49
43
|
export class UserProfileComponent {
|
|
50
|
-
private analytics
|
|
44
|
+
private analytics = inject(Analytics);
|
|
51
45
|
...
|
|
52
46
|
}
|
|
53
47
|
```
|
|
54
48
|
|
|
55
49
|
## Firebase API
|
|
56
50
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
## Services
|
|
60
|
-
|
|
61
|
-
### ScreenTrackingService
|
|
62
|
-
|
|
63
|
-
Coming soon, for now [please review the documentation](https://firebase.google.com/docs/analytics/screenviews)
|
|
51
|
+
AngularFire wraps the Firebase JS SDK to ensure proper functionality in Angular, while providing the same API.
|
|
64
52
|
|
|
65
|
-
|
|
66
|
-
Coming soon
|
|
53
|
+
Update the imports from `import { ... } from 'firebase/analytics'` to `import { ... } from '@angular/fire/analytics'` and follow the official documentation.
|
|
67
54
|
|
|
55
|
+
[Getting Started](https://firebase.google.com/docs/analytics/get-started?platform=web) | [API Reference](https://firebase.google.com/docs/reference/js/analytics)
|
package/docs/app-check.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<small>
|
|
2
|
-
<a href="https://github.com/angular/angularfire">AngularFire</a> ❱ <a href="../README.md#developer-guide">Developer Guide</a> ❱
|
|
2
|
+
<a href="https://github.com/angular/angularfire">AngularFire</a> ❱ <a href="../README.md#developer-guide">Developer Guide</a> ❱ App Check
|
|
3
3
|
</small>
|
|
4
4
|
|
|
5
5
|
<img align="right" width="30%" src="images/reCAPTCHA-logo@1x.png">
|
|
@@ -11,28 +11,31 @@ App Check helps protect your API resources from abuse by preventing unauthorized
|
|
|
11
11
|
[Learn More](https://firebase.google.com/docs/app-check)
|
|
12
12
|
|
|
13
13
|
## Dependency Injection
|
|
14
|
+
|
|
14
15
|
As a prerequisite, ensure that `AngularFire` has been added to your project via
|
|
15
16
|
```bash
|
|
16
17
|
ng add @angular/fire
|
|
17
18
|
```
|
|
18
19
|
|
|
19
|
-
Provide
|
|
20
|
+
Provide a App Check instance in the application's `app.config.ts`:
|
|
20
21
|
|
|
21
22
|
```ts
|
|
22
23
|
import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
|
|
23
|
-
import { provideAppCheck } from '@angular/fire/app-check';
|
|
24
|
+
import { provideAppCheck, initializeAppCheck, ReCaptchaV3Provider } from '@angular/fire/app-check';
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
provideFirebaseApp(() => initializeApp(
|
|
26
|
+
export const appConfig: ApplicationConfig = {
|
|
27
|
+
providers: [
|
|
28
|
+
provideFirebaseApp(() => initializeApp({ ... })),
|
|
28
29
|
provideAppCheck(() => initializeAppCheck(getApp(), {
|
|
29
30
|
provider: new ReCaptchaV3Provider(/* configuration */),
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
})),
|
|
32
|
+
...
|
|
33
|
+
],
|
|
34
|
+
...
|
|
32
35
|
})
|
|
33
36
|
```
|
|
34
37
|
|
|
35
|
-
Next inject it into your component:
|
|
38
|
+
Next inject `AppCheck` it into your component:
|
|
36
39
|
|
|
37
40
|
```ts
|
|
38
41
|
import { Component, inject} from '@angular/core';
|
|
@@ -40,14 +43,15 @@ import { AppCheck } from '@angular/fire/app-check';
|
|
|
40
43
|
|
|
41
44
|
@Component({ ... })
|
|
42
45
|
export class AppCheckComponent {
|
|
43
|
-
private appCheck
|
|
46
|
+
private appCheck = inject(AppCheck);
|
|
44
47
|
...
|
|
45
48
|
}
|
|
46
49
|
```
|
|
47
50
|
|
|
48
51
|
## Firebase API
|
|
49
52
|
|
|
50
|
-
|
|
53
|
+
AngularFire wraps the Firebase JS SDK to ensure proper functionality in Angular, while providing the same API.
|
|
54
|
+
|
|
55
|
+
Update the imports from `import { ... } from 'firebase/app-check'` to `import { ... } from '@angular/fire/app-check'` and follow the official documentation.
|
|
51
56
|
|
|
52
|
-
|
|
53
|
-
Coming soon.
|
|
57
|
+
[Getting Started](https://firebase.google.com/docs/app-check/web/recaptcha-enterprise-provider) | [API Reference](https://firebase.google.com/docs/reference/js/app-check)
|
package/docs/auth.md
CHANGED
|
@@ -20,21 +20,23 @@ As a prerequisite, ensure that `AngularFire` has been added to your project via
|
|
|
20
20
|
ng add @angular/fire
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
Provide
|
|
23
|
+
Provide a Auth instance in the application's `app.config.ts`:
|
|
24
24
|
|
|
25
25
|
```ts
|
|
26
26
|
import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
|
|
27
|
-
import {
|
|
27
|
+
import { provideAuth, getAuth } from '@angular/fire/auth';
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
provideFirebaseApp(() => initializeApp(
|
|
29
|
+
export const appConfig: ApplicationConfig = {
|
|
30
|
+
providers: [
|
|
31
|
+
provideFirebaseApp(() => initializeApp({ ... })),
|
|
32
32
|
provideAuth(() => getAuth()),
|
|
33
|
-
|
|
33
|
+
...
|
|
34
|
+
],
|
|
35
|
+
...
|
|
34
36
|
})
|
|
35
37
|
```
|
|
36
38
|
|
|
37
|
-
Next inject
|
|
39
|
+
Next inject `Auth` into your component:
|
|
38
40
|
|
|
39
41
|
```ts
|
|
40
42
|
import { Component, inject} from '@angular/core';
|
|
@@ -42,7 +44,7 @@ import { Auth } from '@angular/fire/auth';
|
|
|
42
44
|
|
|
43
45
|
@Component({ ... })
|
|
44
46
|
export class LoginComponent {
|
|
45
|
-
private auth
|
|
47
|
+
private auth = inject(Auth);
|
|
46
48
|
...
|
|
47
49
|
}
|
|
48
50
|
```
|
|
@@ -51,10 +53,43 @@ export class LoginComponent {
|
|
|
51
53
|
|
|
52
54
|
AngularFire wraps the Firebase JS SDK to ensure proper functionality in Angular, while providing the same API.
|
|
53
55
|
|
|
54
|
-
Update the imports from `import { ... } from 'firebase/auth'` to `import { ... } from '@angular/fire/auth'` and follow the
|
|
56
|
+
Update the imports from `import { ... } from 'firebase/auth'` to `import { ... } from '@angular/fire/auth'` and follow the official documentation.
|
|
55
57
|
|
|
56
58
|
[Getting Started](https://firebase.google.com/docs/auth/web/start) | [API Reference](https://firebase.google.com/docs/reference/js/auth)
|
|
57
59
|
|
|
60
|
+
## Server-side Rendering
|
|
61
|
+
|
|
62
|
+
To support Auth context in server-side rendering, you can provide `FirebaseServerApp`:
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
import { ApplicationConfig, PLATFORM_ID, inject } from '@angular/core';
|
|
66
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
67
|
+
import { provideFirebaseApp, initializeApp, initializeServeApp, initializeServerApp } from '@angular/fire/app';
|
|
68
|
+
import { provideAuth, getAuth } from '@angular/fire/auth';
|
|
69
|
+
|
|
70
|
+
export const appConfig: ApplicationConfig = {
|
|
71
|
+
providers: [
|
|
72
|
+
provideFirebaseApp(() => {
|
|
73
|
+
if (isPlatformBrowser(inject(PLATFORM_ID))) {
|
|
74
|
+
return initializeApp(firebaseConfig);
|
|
75
|
+
}
|
|
76
|
+
// Optional, since it's null in dev-mode and SSG
|
|
77
|
+
const request = inject(REQUEST, { optional: true });
|
|
78
|
+
const authIdToken = request?.headers.authorization?.split("Bearer ")[1];
|
|
79
|
+
return initializeServerApp(firebaseConfig, {
|
|
80
|
+
authIdToken,
|
|
81
|
+
releaseOnDeref: request || undefined
|
|
82
|
+
});
|
|
83
|
+
}),
|
|
84
|
+
provideAuth(() => getAuth(inject(FirebaseApp)),
|
|
85
|
+
...
|
|
86
|
+
],
|
|
87
|
+
...
|
|
88
|
+
})
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Follow Firebase's [ Session Management with Service Workers documentation](https://firebase.google.com/docs/auth/web/service-worker-sessions) to learn how to pass the `idToken` to the server. __Note: this will not currently work in dev-mode as Angular SSR does not provide a method to get the Request headers.__
|
|
92
|
+
|
|
58
93
|
## Convenience observables
|
|
59
94
|
|
|
60
95
|
AngularFire provides observables to allow convenient use of the Firebase Authentication with RXJS.
|
package/docs/database.md
CHANGED
|
@@ -17,32 +17,32 @@ As a prerequisite, ensure that `AngularFire` has been added to your project via
|
|
|
17
17
|
ng add @angular/fire
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
Provide
|
|
20
|
+
Provide a Database instance in the application's `app.config.ts`:
|
|
21
21
|
|
|
22
22
|
```ts
|
|
23
23
|
import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
|
|
24
|
-
import {
|
|
24
|
+
import { provideDatabase, getDatabase } from '@angular/fire/database';
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
provideFirebaseApp(() => initializeApp(
|
|
26
|
+
export const appConfig: ApplicationConfig = {
|
|
27
|
+
providers: [
|
|
28
|
+
provideFirebaseApp(() => initializeApp({ ... })),
|
|
29
29
|
provideDatabase(() => getDatabase()),
|
|
30
|
-
|
|
30
|
+
...
|
|
31
|
+
],
|
|
32
|
+
...
|
|
31
33
|
})
|
|
32
34
|
```
|
|
33
35
|
|
|
34
|
-
Next inject
|
|
36
|
+
Next inject `Database` into your component:
|
|
35
37
|
|
|
36
38
|
```ts
|
|
37
39
|
import { Component, inject } from '@angular/core';
|
|
38
40
|
import { Database } from '@angular/fire/database';
|
|
39
41
|
|
|
40
42
|
@Component({...})
|
|
41
|
-
|
|
42
|
-
private database
|
|
43
|
-
|
|
44
|
-
constructor() {
|
|
45
|
-
}
|
|
43
|
+
export class DepartmentComponent {
|
|
44
|
+
private database = inject(Database);
|
|
45
|
+
...
|
|
46
46
|
}
|
|
47
47
|
```
|
|
48
48
|
|
|
@@ -50,7 +50,7 @@ extend class DepartmentComponent {
|
|
|
50
50
|
|
|
51
51
|
AngularFire wraps the Firebase JS SDK to ensure proper functionality in Angular, while providing the same API.
|
|
52
52
|
|
|
53
|
-
Just change your imports from `import { ... } from 'firebase/database'` to `import { ... } from '@angular/fire/database'` and follow the
|
|
53
|
+
Just change your imports from `import { ... } from 'firebase/database'` to `import { ... } from '@angular/fire/database'` and follow the official documentation.
|
|
54
54
|
|
|
55
55
|
[Getting Started](https://firebase.google.com/docs/database/web/start) | [API Reference](https://firebase.google.com/docs/reference/js/database)
|
|
56
56
|
|
package/docs/firestore.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<img align="right" width="30%" src="images/firestore-illo_1x.png">
|
|
2
2
|
|
|
3
3
|
<small>
|
|
4
|
-
<a href="https://github.com/angular/angularfire">AngularFire</a> ❱ <a href="../README.md#developer-guide">Developer Guide</a> ❱
|
|
4
|
+
<a href="https://github.com/angular/angularfire">AngularFire</a> ❱ <a href="../README.md#developer-guide">Developer Guide</a> ❱ Cloud Firestore
|
|
5
5
|
</small>
|
|
6
6
|
|
|
7
7
|
# Cloud Firestore
|
|
@@ -18,47 +18,45 @@ As a prerequisite, ensure that `AngularFire` has been added to your project via
|
|
|
18
18
|
```bash
|
|
19
19
|
ng add @angular/fire
|
|
20
20
|
```
|
|
21
|
-
Provide a Firestore instance in the application's `
|
|
21
|
+
Provide a Firestore instance in the application's `app.config.ts`:
|
|
22
22
|
|
|
23
|
-
```
|
|
24
|
-
@
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
```ts
|
|
24
|
+
import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
|
|
25
|
+
import { provideFirestore, getFirestore } from '@angular/fire/firestore';
|
|
26
|
+
|
|
27
|
+
export const appConfig: ApplicationConfig = {
|
|
28
|
+
providers: [
|
|
29
|
+
provideFirebaseApp(() => initializeApp({ ... })),
|
|
30
|
+
provideFirestore(() => getFirestore()),
|
|
29
31
|
...
|
|
30
|
-
// App initialization
|
|
31
|
-
provideFirebaseApp(() => initializeApp(environment.firebase)),
|
|
32
|
-
provideFirestore(() => getFirestore())
|
|
33
32
|
],
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
})
|
|
37
|
-
export class AppModule { }
|
|
33
|
+
...
|
|
34
|
+
}
|
|
38
35
|
```
|
|
39
36
|
|
|
40
|
-
|
|
41
|
-
In your component class, for example `user-profile.component.ts` import and inject `Firestore`:
|
|
37
|
+
Next inject `Firestore` into your component:
|
|
42
38
|
|
|
43
39
|
```typescript
|
|
44
40
|
import { Component, inject } from '@angular/core';
|
|
45
41
|
import { Firestore } from '@angular/fire/firestore';
|
|
46
42
|
|
|
47
|
-
@Component({
|
|
48
|
-
standalone: true,
|
|
49
|
-
selector: 'app-user-profile',
|
|
50
|
-
...
|
|
51
|
-
})
|
|
43
|
+
@Component({ ... })
|
|
52
44
|
export class UserProfileComponent {
|
|
53
|
-
private firestore
|
|
45
|
+
private firestore = inject(Firestore);
|
|
54
46
|
...
|
|
55
47
|
}
|
|
56
48
|
```
|
|
57
49
|
|
|
58
50
|
## Firebase API
|
|
59
|
-
|
|
51
|
+
|
|
52
|
+
AngularFire wraps the Firebase JS SDK to ensure proper functionality in Angular, while providing the same API.
|
|
53
|
+
|
|
54
|
+
Update the imports from `import { ... } from 'firebase/firestore'` to `import { ... } from '@angular/fire/firestore'` and follow the official documentation.
|
|
55
|
+
|
|
56
|
+
[Getting Started](https://firebase.google.com/docs/firestore/quickstart#web-modular-api) | [API Reference](https://firebase.google.com/docs/reference/js/firestore)
|
|
60
57
|
|
|
61
58
|
### Reading data
|
|
59
|
+
|
|
62
60
|
In Cloud Firestore data is stored in `documents` and `documents` are stored in `collections`. The path to data follows `<collection_name>/<document_id>` and continues if there are subcollections. For example, `"users/ABC12345/posts/XYZ6789"` represents:
|
|
63
61
|
* `users` collection
|
|
64
62
|
* document id `ABC12345`
|
|
@@ -111,6 +109,7 @@ export Interface UserProfile {
|
|
|
111
109
|
The `async` pipe handles unsubscribing from observables.
|
|
112
110
|
|
|
113
111
|
### Writing data
|
|
112
|
+
|
|
114
113
|
To write to Cloud Firestore use the `addDoc` function. It will create a new document at the path specified by the collection. In `user-profile.component.ts`, we'll update the code to add a new document on a `<button>` click.
|
|
115
114
|
|
|
116
115
|
|
package/docs/functions.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<img align="right" width="30%" src="images/functions-illo_1x.png">
|
|
2
2
|
|
|
3
3
|
<small>
|
|
4
|
-
<a href="https://github.com/angular/angularfire">AngularFire</a> ❱ <a href="../README.md#developer-guide">Developer Guide</a> ❱
|
|
4
|
+
<a href="https://github.com/angular/angularfire">AngularFire</a> ❱ <a href="../README.md#developer-guide">Developer Guide</a> ❱ Cloud Functions
|
|
5
5
|
</small>
|
|
6
6
|
|
|
7
7
|
# Cloud Functions
|
|
@@ -17,21 +17,23 @@ As a prerequisite, ensure that `AngularFire` has been added to your project via
|
|
|
17
17
|
ng add @angular/fire
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
Provide a Cloud Functions instance in the application's `
|
|
20
|
+
Provide a Cloud Functions instance in the application's `app.config.ts`:
|
|
21
21
|
|
|
22
22
|
```ts
|
|
23
23
|
import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
|
|
24
|
-
import {
|
|
24
|
+
import { provideFunctions, getFunctions } from '@angular/fire/functions';
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
provideFirebaseApp(() => initializeApp(
|
|
26
|
+
export const appConfig: ApplicationConfig = {
|
|
27
|
+
providers: [
|
|
28
|
+
provideFirebaseApp(() => initializeApp({ ... })),
|
|
29
29
|
provideFunctions(() => getFunctions()),
|
|
30
|
-
|
|
30
|
+
...
|
|
31
|
+
],
|
|
32
|
+
...
|
|
31
33
|
})
|
|
32
34
|
```
|
|
33
35
|
|
|
34
|
-
Next inject
|
|
36
|
+
Next inject `Functions` into your component:
|
|
35
37
|
|
|
36
38
|
```ts
|
|
37
39
|
import { Component, inject} from '@angular/core';
|
|
@@ -39,14 +41,15 @@ import { Functions } from '@angular/fire/functions';
|
|
|
39
41
|
|
|
40
42
|
@Component({ ... })
|
|
41
43
|
export class AppComponent {
|
|
42
|
-
private functions
|
|
44
|
+
private functions = inject(Functions);
|
|
43
45
|
...
|
|
44
46
|
}
|
|
45
47
|
```
|
|
46
48
|
|
|
47
49
|
## Firebase API
|
|
48
|
-
The [Firebase API for Cloud Functions documentation](https://firebase.google.com/docs/reference/js/functions) is available on the Firebase website.
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
AngularFire wraps the Firebase JS SDK to ensure proper functionality in Angular, while providing the same API.
|
|
52
|
+
|
|
53
|
+
Update the imports from `import { ... } from 'firebase/functions'` to `import { ... } from '@angular/fire/functions'` and follow the official documentation.
|
|
51
54
|
|
|
52
|
-
|
|
55
|
+
[Call functions from your app](https://firebase.google.com/docs/functions/callable?gen=2nd#web-modular-api) | [API Reference](https://firebase.google.com/docs/reference/js/functions)
|
package/docs/messaging.md
CHANGED
|
@@ -1,25 +1,47 @@
|
|
|
1
1
|
<img align="right" width="30%" src="images/cloud-messaging-illo_1x.png">
|
|
2
2
|
|
|
3
3
|
<small>
|
|
4
|
-
<a href="https://github.com/angular/angularfire">AngularFire</a> ❱ <a href="../README.md#developer-guide">Developer Guide</a> ❱
|
|
4
|
+
<a href="https://github.com/angular/angularfire">AngularFire</a> ❱ <a href="../README.md#developer-guide">Developer Guide</a> ❱ Cloud Messaging
|
|
5
5
|
</small>
|
|
6
6
|
|
|
7
7
|
# Cloud Messaging
|
|
8
8
|
|
|
9
9
|
Firebase FCM allows you to register devices with unique FCM tokens, that you can later programtically send notifications to using Firebase Cloud Functions. It is up to the application to update these tokens in Firebase if you want to use them in other layers of your application, i.e send a notification to all administrators, etc. In that case, you would likely want to store your fcm tokens on your user collection, or a sub collection or another collection with different permissions.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
## Dependency Injection
|
|
12
12
|
|
|
13
|
+
As a prerequisite, ensure that `AngularFire` has been added to your project via
|
|
14
|
+
```bash
|
|
15
|
+
ng add @angular/fire
|
|
13
16
|
```
|
|
14
|
-
import { getMessaging, provideMessaging } from "@angular/fire/messaging";
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
Provide a Cloud Messaging instance in the application's `app.config.ts`:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
|
|
22
|
+
import { provideMessaging, getMessaging } from '@angular/fire/messaging';
|
|
23
|
+
|
|
24
|
+
export const appConfig: ApplicationConfig = {
|
|
17
25
|
providers: [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
26
|
+
provideFirebaseApp(() => initializeApp({ ... })),
|
|
27
|
+
provideMessaging(() => getMessaging()),
|
|
28
|
+
...
|
|
21
29
|
],
|
|
22
|
-
|
|
30
|
+
...
|
|
31
|
+
})
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Next inject `Messaging` into your component:
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import { Component, inject} from '@angular/core';
|
|
38
|
+
import { Messaging } from '@angular/fire/messaging';
|
|
39
|
+
|
|
40
|
+
@Component({ ... })
|
|
41
|
+
export class AppComponent {
|
|
42
|
+
private messaging = inject(Messaging);
|
|
43
|
+
...
|
|
44
|
+
}
|
|
23
45
|
```
|
|
24
46
|
|
|
25
47
|
# Create a Firebase Messaging Service Worker
|
package/docs/performance.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<img align="right" width="30%" src="images/performance-illo_1x.png">
|
|
2
2
|
|
|
3
3
|
<small>
|
|
4
|
-
<a href="https://github.com/angular/angularfire">AngularFire</a> ❱ <a href="../README.md#developer-guide">Developer Guide</a> ❱
|
|
4
|
+
<a href="https://github.com/angular/angularfire">AngularFire</a> ❱ <a href="../README.md#developer-guide">Developer Guide</a> ❱ Performance Monitoring
|
|
5
5
|
</small>
|
|
6
6
|
|
|
7
7
|
# Performance Monitoring
|
|
@@ -17,21 +17,23 @@ As a prerequisite, ensure that `AngularFire` has been added to your project via
|
|
|
17
17
|
ng add @angular/fire
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
Provide a Performance instance
|
|
20
|
+
Provide a Performance instance in the application's `app.config.ts`:
|
|
21
21
|
|
|
22
22
|
```ts
|
|
23
23
|
import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
|
|
24
|
-
import {
|
|
24
|
+
import { providePerformance, getPerformance } from '@angular/fire/performance';
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
provideFirebaseApp(() => initializeApp(
|
|
26
|
+
export const appConfig: ApplicationConfig = {
|
|
27
|
+
providers: [
|
|
28
|
+
provideFirebaseApp(() => initializeApp({ ... })),
|
|
29
29
|
providePerformance(() => getPerformance()),
|
|
30
|
-
|
|
30
|
+
...
|
|
31
|
+
],
|
|
32
|
+
...
|
|
31
33
|
})
|
|
32
34
|
```
|
|
33
35
|
|
|
34
|
-
Next inject
|
|
36
|
+
Next inject `Performance` into your component:
|
|
35
37
|
|
|
36
38
|
```ts
|
|
37
39
|
import { Component, inject} from '@angular/core';
|
|
@@ -39,19 +41,15 @@ import { Performance } from '@angular/fire/performance';
|
|
|
39
41
|
|
|
40
42
|
@Component({ ... })
|
|
41
43
|
export class PerformanceComponent {
|
|
42
|
-
private performance
|
|
44
|
+
private performance = inject(Performance);
|
|
43
45
|
...
|
|
44
46
|
}
|
|
45
47
|
```
|
|
46
48
|
|
|
47
49
|
## Firebase API
|
|
48
50
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
## Services
|
|
52
|
-
|
|
53
|
-
Coming soon.
|
|
51
|
+
AngularFire wraps the Firebase JS SDK to ensure proper functionality in Angular, while providing the same API.
|
|
54
52
|
|
|
55
|
-
|
|
53
|
+
Update the imports from `import { ... } from 'firebase/performance'` to `import { ... } from '@angular/fire/performance'` and follow the official documentation.
|
|
56
54
|
|
|
57
|
-
|
|
55
|
+
[Getting Started](https://firebase.google.com/docs/perf-mon/get-started-web) | [API Reference](https://firebase.google.com/docs/reference/js/performance)
|
package/docs/remote-config.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<img align="right" width="30%" src="images/remote-config-illo_1x.png">
|
|
2
2
|
|
|
3
3
|
<small>
|
|
4
|
-
<a href="https://github.com/angular/angularfire">AngularFire</a> ❱ <a href="../README.md#developer-guide">Developer Guide</a> ❱
|
|
4
|
+
<a href="https://github.com/angular/angularfire">AngularFire</a> ❱ <a href="../README.md#developer-guide">Developer Guide</a> ❱ Remote Config
|
|
5
5
|
</small>
|
|
6
6
|
|
|
7
7
|
# Remote Config
|
|
@@ -17,21 +17,23 @@ As a prerequisite, ensure that `AngularFire` has been added to your project via
|
|
|
17
17
|
ng add @angular/fire
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
Provide a
|
|
20
|
+
Provide a Remote Config instance in the application's `app.config.ts`:
|
|
21
21
|
|
|
22
22
|
```ts
|
|
23
23
|
import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
|
|
24
|
-
import {
|
|
24
|
+
import { provideRemoteConfig, getRemoteConfig } from '@angular/fire/remote-config';
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
provideFirebaseApp(() => initializeApp(
|
|
26
|
+
export const appConfig: ApplicationConfig = {
|
|
27
|
+
providers: [
|
|
28
|
+
provideFirebaseApp(() => initializeApp({ ... })),
|
|
29
29
|
provideRemoteConfig(() => getRemoteConfig()),
|
|
30
|
-
|
|
30
|
+
...
|
|
31
|
+
],
|
|
32
|
+
...
|
|
31
33
|
})
|
|
32
34
|
```
|
|
33
35
|
|
|
34
|
-
Next inject
|
|
36
|
+
Next inject `RemoteConfig` into your component:
|
|
35
37
|
|
|
36
38
|
```ts
|
|
37
39
|
import { Component, inject} from '@angular/core';
|
|
@@ -39,15 +41,15 @@ import { RemoteConfig } from '@angular/fire/remote-config';
|
|
|
39
41
|
|
|
40
42
|
@Component({ ... })
|
|
41
43
|
export class RemoteConfigComponent {
|
|
42
|
-
private remoteConfig
|
|
44
|
+
private remoteConfig = inject(RemoteConfig);
|
|
43
45
|
...
|
|
44
46
|
}
|
|
45
47
|
```
|
|
46
48
|
|
|
47
49
|
## Firebase API
|
|
48
50
|
|
|
49
|
-
|
|
51
|
+
AngularFire wraps the Firebase JS SDK to ensure proper functionality in Angular, while providing the same API.
|
|
50
52
|
|
|
51
|
-
|
|
53
|
+
Update the imports from `import { ... } from 'firebase/remote-config'` to `import { ... } from '@angular/fire/remote-config'` and follow the official documentation.
|
|
52
54
|
|
|
53
|
-
|
|
55
|
+
[Getting Started](https://firebase.google.com/docs/remote-config/get-started?platform=web) | [API Reference](https://firebase.google.com/docs/reference/js/remote-config)
|
package/docs/storage.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<img align="right" width="30%" src="images/storage-illo_1x.png">
|
|
2
2
|
|
|
3
3
|
<small>
|
|
4
|
-
<a href="https://github.com/angular/angularfire">AngularFire</a> ❱ <a href="../README.md#developer-guide">Developer Guide</a> ❱
|
|
4
|
+
<a href="https://github.com/angular/angularfire">AngularFire</a> ❱ <a href="../README.md#developer-guide">Developer Guide</a> ❱ Cloud Storage
|
|
5
5
|
</small>
|
|
6
6
|
|
|
7
7
|
# Cloud Storage
|
|
@@ -19,21 +19,23 @@ As a prerequisite, ensure that `AngularFire` has been added to your project via
|
|
|
19
19
|
ng add @angular/fire
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
Provide a
|
|
22
|
+
Provide a Cloud Storage instance in the application's `app.config.ts`:
|
|
23
23
|
|
|
24
24
|
```ts
|
|
25
25
|
import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
|
|
26
|
-
import {
|
|
26
|
+
import { provideStorage, getStorage } from '@angular/fire/storage';
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
provideFirebaseApp(() => initializeApp(
|
|
28
|
+
export const appConfig: ApplicationConfig = {
|
|
29
|
+
providers: [
|
|
30
|
+
provideFirebaseApp(() => initializeApp({ ... })),
|
|
31
31
|
provideStorage(() => getStorage()),
|
|
32
|
-
|
|
32
|
+
...
|
|
33
|
+
],
|
|
34
|
+
...
|
|
33
35
|
})
|
|
34
36
|
```
|
|
35
37
|
|
|
36
|
-
Next inject
|
|
38
|
+
Next inject `Storage` into your component:
|
|
37
39
|
|
|
38
40
|
```ts
|
|
39
41
|
import { Component, inject} from '@angular/core';
|
|
@@ -41,17 +43,16 @@ import { Storage } from '@angular/fire/storage';
|
|
|
41
43
|
|
|
42
44
|
@Component({ ... })
|
|
43
45
|
export class StorageComponent {
|
|
44
|
-
private storage
|
|
46
|
+
private storage = inject(Storage);
|
|
45
47
|
...
|
|
46
48
|
}
|
|
47
49
|
```
|
|
48
50
|
|
|
49
|
-
|
|
50
51
|
## Firebase API
|
|
51
52
|
|
|
52
53
|
AngularFire wraps the Firebase JS SDK to ensure proper functionality in Angular, while providing the same API.
|
|
53
54
|
|
|
54
|
-
Update the imports from `import { ... } from 'firebase/storage'` to `import { ... } from '@angular/fire/storage'` and follow the
|
|
55
|
+
Update the imports from `import { ... } from 'firebase/storage'` to `import { ... } from '@angular/fire/storage'` and follow the official documentation.
|
|
55
56
|
|
|
56
57
|
[Getting Started](https://firebase.google.com/docs/storage/web/start) | [API Reference](https://firebase.google.com/docs/reference/js/storage)
|
|
57
58
|
|
package/docs/vertexai.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<small>
|
|
2
|
+
<a href="https://github.com/angular/angularfire">AngularFire</a> ❱ <a href="../README.md#developer-guide">Developer Guide</a> ❱ Vertex AI
|
|
3
|
+
</small>
|
|
4
|
+
|
|
5
|
+
# Vertex AI (preview)
|
|
6
|
+
|
|
7
|
+
The Vertex AI Gemini API gives you access to the latest generative AI models from Google: the Gemini models.
|
|
8
|
+
|
|
9
|
+
[Learn more](https://firebase.google.com/docs/vertex-ai)
|
|
10
|
+
|
|
11
|
+
## Dependency Injection
|
|
12
|
+
|
|
13
|
+
As a prerequisite, ensure that `AngularFire` has been added to your project via
|
|
14
|
+
```bash
|
|
15
|
+
ng add @angular/fire
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Provide a Vertex AI instance in the application's `app.config.ts`:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
|
|
22
|
+
import { provideVertexAI, getVertexAI } from '@angular/fire/vertexai-preview';
|
|
23
|
+
|
|
24
|
+
export const appConfig: ApplicationConfig = {
|
|
25
|
+
providers: [
|
|
26
|
+
provideFirebaseApp(() => initializeApp({ ... })),
|
|
27
|
+
provideVertexAI(() => getVertexAI()),
|
|
28
|
+
...
|
|
29
|
+
],
|
|
30
|
+
...,
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Next inject `VertexAI` into your component:
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { Component, inject } from '@angular/core';
|
|
38
|
+
import { VertexAI } from '@angular/fire/vertexai-preview';
|
|
39
|
+
|
|
40
|
+
@Component({ ... })
|
|
41
|
+
export class MyComponent {
|
|
42
|
+
private vertexAI = inject(VertexAI);
|
|
43
|
+
...
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Firebase API
|
|
48
|
+
|
|
49
|
+
AngularFire wraps the Firebase JS SDK to ensure proper functionality in Angular, while providing the same API.
|
|
50
|
+
|
|
51
|
+
Update the imports from `import { ... } from 'firebase/vertexai-preview'` to `import { ... } from '@angular/fire/vertexai-preview'` and follow the official documentation.
|
|
52
|
+
|
|
53
|
+
[Getting Started](https://firebase.google.com/docs/vertex-ai/get-started?platform=web) | [API Reference](https://firebase.google.com/docs/reference/js/vertexai-preview)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "../node_modules/ng-packagr/package.schema.json",
|
|
3
3
|
"name": "@angular/fire",
|
|
4
|
-
"version": "17.1.0-canary.
|
|
4
|
+
"version": "17.1.0-canary.58e6c3b",
|
|
5
5
|
"description": "Angular + Firebase = ❤️",
|
|
6
6
|
"schematics": "./schematics/collection.json",
|
|
7
7
|
"builders": "./schematics/builders.json",
|