Skip to content

Commit 27c857d

Browse files
authored
Merge branch 'master' into database-refactor
2 parents fefe3e5 + 0885173 commit 27c857d

19 files changed

+5218
-42
lines changed

docs/2-retrieving-data-as-objects.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The guide below demonstrates how to retrieve, save, and remove data as objects.
1010

1111
**Make sure you have bootstrapped your application for AngularFire. See the Installation guide for bootstrap setup.**
1212

13-
AngularFireDatabase is a service which can be injected through the constructor of your Angular component or `@Injectable()` service.
13+
`AngularFireDatabase` is a service which can be injected through the constructor of your Angular component or `@Injectable()` service.
1414

1515
If you've followed the earlier step "Installation and Setup" your `/src/app/app.component.ts` should look like below.
1616

docs/7-deploying-angularfire-to-firebase.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ng build -prod
1212

1313
### 1. Run Firebase init
1414

15-
You must initliazie firebase hosting in order to deploy your application. In order to this run the `firebase init` command.
15+
You must initialize Firebase Hosting in order to deploy your application. In order to do this run the `firebase init` command.
1616
This command prompts you to give the public directory. Choose the /dist directory created by the `ng build -prod`.
1717
`firebase init` will also ask you if you want to overwrite your index file. Type `no` since your angular app includes a index file.
1818

docs/Auth-with-Ionic2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ v6.9.1
1919

2020
```
2121

22-
As of writting this document, this is the most stable version. If you're not on this version,
22+
As of writing this document, this is the most stable version. If you're not on this version,
2323
please upgrade yourself to latest version by installing node from [here](https://nodejs.org).
2424

2525
Check your npm version by executing the following command.

docs/Auth-with-Ionic3-Angular4.md

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,34 @@ This tutorial uses **Facebook** as the sign-in provider. After completion of thi
1212
other sign-in providers like **Twitter**, **Google** on your own.
1313

1414
### Prerequisites
15-
The first step is to ensure you've latest version of **Node** installed.
15+
The first step is to ensure you have latest version of **Node** installed.
1616
You can get the latest version from [here](https://nodejs.org).
1717
This will install both node and npm.
1818

19-
After installing node, check the version by executing the following command in your prompt window.
19+
After installing node, check the version by executing the following command in your prompt window:
2020

2121
```bash
2222

2323
C:\projects>node -v
2424
v6.10.2
2525

2626
```
27-
As of writting this document, this is the most stable version. If you're not on this version,
27+
As of this writing, this is the most stable version. If you're not on this version,
2828
please upgrade yourself to latest version by installing node from [here](https://nodejs.org).
2929

30-
Check your npm version by executing the following command.
30+
Check your npm version by executing the following command:
3131
```bash
3232

3333
C:\projects>npm -v
3434
3.10.10
3535

3636
```
37-
Install the Angular CLI, which will be used to build our Angular project and install Angular version 4 later.
37+
Install the Angular CLI, which will be used to build our Angular project and install Angular version 4 or later.
3838

3939
```bash
4040
C:\projects>npm install -g @angular/cli
4141
```
42-
Check your angular version by executing the following command.
42+
Check your angular version by executing the following command:
4343

4444
```bash
4545
C:\projects>ng -v
@@ -63,7 +63,7 @@ C:\projects>npm install -g ionic
6363

6464
```
6565

66-
Once the above commands are executed successfully, Check the versions of cordova and ionic by executing the following commands.
66+
Once the above commands are executed successfully, check the versions of cordova and ionic by executing the following commands.
6767

6868
```bash
6969
C:\projects>cordova -v
@@ -73,19 +73,19 @@ C:\projects>ionic -v
7373
3.4.0
7474
```
7575

76-
These are the latest versions as of writting this document.
76+
These are the latest versions as of this writing.
7777

78-
On successful execution of above commands, you're all set to create your app with Ionic framework.
78+
On successful execution of the above commands, you're all set to create your app with Ionic framework.
7979

80-
To create your app, change into the directory where you want your app to reside and execute the following command
80+
To create your app, change into the directory where you want your app to reside and execute the following command:
8181

8282
```bash
8383
C:\projects> ionic start auth-ng4-ionic3-af2 blank
8484
```
8585

8686
>The command ionic start will create the project with name "Ionic_AngularFire2_Project" using "blank" template.
8787
88-
Change to the project directory, which was just created with above command
88+
Change to the project directory, which was just created with the above command.
8989

9090
> C:\projects\auth-ng4-ionic3-af2>ionic info
9191
@@ -115,7 +115,7 @@ System:
115115
```
116116
You need to ensure you've got Ionic Framework Version 3, as shown above.
117117

118-
Alternatively you can open `package.json` to ensure you've got the following angualr and Ionic versions
118+
Alternatively you can open `package.json` to ensure you've got the following Angular and Ionic versions:
119119

120120
```json
121121
"dependencies": {
@@ -147,23 +147,23 @@ Alternatively you can open `package.json` to ensure you've got the following ang
147147

148148
If not, replace them to match above. These are the latest as of writing this tutorial.
149149

150-
To start your app, execute the following command
150+
To start your app, execute the following command:
151151

152152
```bash
153153

154154
C:\projects\auth-ng4-ionic3-af2> ionic serve
155155

156156
```
157-
If everything is installed correctly, the app should open your browser with the dev server running at following url
157+
If everything is installed correctly, the app should open your browser with the dev server running at the following url
158158
**`http://localhost:8100`** and will display default home page.
159159

160160
### Configuring AngularFire2 and Firebase
161161

162-
Install angularfire2 and firebase by executing the following command in your project directory
162+
Install angularfire2 and firebase by executing the following command in your project directory:
163163

164164
```ts
165165

166-
C:\projects\auth-ng4-ionic3-af2>npm install angularfire2 firebase --save
166+
C:\projects\auth-ng4-ionic3-af2>npm install angularfire2 firebase promise-polyfill --save
167167

168168
```
169169

@@ -182,9 +182,9 @@ and add the following three entries.
182182
183183
>2) Define your firebaseConfig constant.
184184
185-
>3) Initialize your app, by adding AngularFireModule in the "imports" array in @NgModule
185+
>3) Initialize your app, by adding AngularFireModule and AngularFireAuthModule in the "imports" array in @NgModule
186186
187-
>3) Also, add AngularFireDatabaseModule in the "imports" array in @NgModule
187+
>4) Also, add AngularFireDatabase in the "providers" array in @NgModule
188188
189189
your `app.module.ts` file should look something like this.
190190

@@ -231,6 +231,7 @@ export const firebaseConfig = {
231231
providers: [
232232
StatusBar,
233233
SplashScreen,
234+
AngularFireDatabase,
234235
{provide: ErrorHandler, useClass: IonicErrorHandler}
235236
]
236237
})
@@ -249,7 +250,7 @@ following changes:
249250
250251
>3) Call the list method on AngularFireDatabase object.
251252
252-
Your `home.ts` file should look like this.
253+
Your `home.ts` file should look like this:
253254

254255
```typescript
255256

@@ -403,7 +404,7 @@ Also, update your `app.module.ts` to contain following import
403404
and add it to the imports array.
404405

405406

406-
Run the app and click on the Login Button, you should see a pop-up asking you to enter username and password for facebook to
407+
Run the app and click on the Login Button, you should see a pop-up asking you to enter username and password for Facebook to
407408
authenticate. Once authenticated, you should see the response from Facebook in console window.
408409

409410
Inspect the Object in the console, under `user` property, you should see all the attributes and we're going to use two of them, next.
@@ -459,7 +460,7 @@ export class HomePage {
459460

460461
```
461462

462-
and `home.html` shouldlook like this
463+
and `home.html` should look like this:
463464

464465
```html
465466

@@ -487,12 +488,12 @@ which should open the facebook pop-up.
487488
Once you authenticate yourself, you should see your Facebook display name on your screen.
488489
Click the Logout button, which will make the AuthState to null and you should see the difference on your screen.
489490

490-
You can try redirecting yourself to another page to grab additional details from Facebook and experiement on your own.
491+
You can try redirecting yourself to another page to grab additional details from Facebook and experiment on your own.
491492

492493

493494
***Running our application on mobile phone***
494495

495-
Ensure you've the platform added to your project. If not add the platform by executing the following command.
496+
Ensure you've the platform added to your project. If not add the platform by executing the following command:
496497

497498
```
498499
@@ -503,7 +504,7 @@ C:\projects\auth-ng4-ionic3-af2>ionic platform add android
503504
This adds android platform for your project.
504505
Replace android with ios, if you're on Mac book or add both. The generic command is ```ionic platform add <platform-name>```
505506

506-
Now, let's try to run the app in browser. Execute the command
507+
Now, let's try to run the app in browser. Execute the command:
507508

508509
```
509510
@@ -519,10 +520,10 @@ mobile phones, we need to have access to ***Native Mobile API's***, which are pr
519520

520521
List of all Ionic Native API's for cordova plugins can be found [here](http://ionicframework.com/docs/v2/native/).
521522

522-
Let's look at configuring and installing facebook plugin [here](http://ionicframework.com/docs/v2/native/facebook/).
523+
Let's look at configuring and installing the Facebook plugin [here](http://ionicframework.com/docs/v2/native/facebook/).
523524
_Ensure you follow the steps correctly to configure your app._
524525

525-
Login to facebook dashboard [here](https://developers.facebook.com/apps/), go to your App and make a note of your App ID.
526+
Login to the Facebook dashboard [here](https://developers.facebook.com/apps/), go to your App and make a note of your App ID.
526527
Next go to command prompt in your project directory and execute the following command by replacing the `APP_ID` with your App Id
527528
and `APP_NAME` with your App Name.
528529

@@ -533,7 +534,7 @@ ionic cordova plugin add cordova-plugin-facebook4 --variable APP_ID="123456789"
533534

534535
```
535536

536-
This should add following entry in your config.xml, located at the root of your project.
537+
This should add the following entry in your config.xml, located at the root of your project:
537538

538539
```xml
539540

@@ -547,15 +548,15 @@ This will install the cordova plugin for facebook.
547548

548549
You should also see a sub-folder named `cordova-plugin-facebook4` under your `plugins` folder.
549550

550-
Add the native dependencies by executing the following command.
551+
Add the native dependencies by executing the following command:
551552

552553
```bash
553554

554555
C:\projects\auth-ng4-ionic3-af2>npm install --save @ionic-native/facebook
555556

556557
```
557558

558-
After executing the above command, ensure you got following entry in your `package.json`
559+
After executing the above command, ensure you have the following entry in your `package.json`:
559560

560561
```bash
561562

@@ -573,7 +574,7 @@ import { Facebook } from '@ionic-native/facebook';
573574

574575
Update the "signInWithFacebook" method and use Platform Service to determine the platform and run the appropriate code.
575576

576-
your `home.ts` should look as below
577+
Your `home.ts` should look as below:
577578

578579
```typescript
579580

@@ -630,7 +631,7 @@ export class HomePage {
630631

631632
You'll also need to add the "Facebook" object in the provider section in app.module.ts.
632633

633-
The final `app.module.ts` should look like below
634+
The final `app.module.ts` should look like below:
634635

635636
```typescript
636637

@@ -685,21 +686,21 @@ export class AppModule {}
685686

686687
```
687688

688-
Verfiy your app is running in browser by executing the following command
689+
Verfiy your app is running in browser by executing the following command:
689690

690691
```bash
691692

692693
C:\projects\auth-ng4-ionic3-af2>ionic serve
693694

694695
```
695696

696-
Everything should work. Now trying running the app on your android phone
697+
Everything should work. Now trying running the app on your android phone:
697698

698699
```bash
699700

700701
C:\projects\auth-ng4-ionic3-af2> ionic cordova run android
701702

702703
```
703704

704-
Once the App launches click on the Login button. You should get the facebook pop-up window. Enter your credentials.
705+
Once the App launches click on the Login button. You should get the Facebook pop-up window. Enter your credentials.
705706
On successful authentication, you should see your Facebook Display name and profile picture on your screen.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"test": "npm run build && karma start --single-run",
88
"test:watch": "concurrently \"npm run build:watch\" \"npm run delayed_karma\"",
99
"test:debug": "npm run build && karma start",
10+
"test:universal": "npm run build && cp -R dist/packages-dist test/universal-test/node_modules/angularfire2 && cd test/universal-test && npm run prerender",
1011
"delayed_karma": "sleep 10 && karma start",
1112
"build": "rm -rf dist && node tools/build.js",
1213
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1"

test/universal-test/.angular-cli.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"project": {
4+
"name": "universal-test"
5+
},
6+
"apps": [
7+
{
8+
"platform": "server",
9+
"root": "src",
10+
"outDir": "dist-server",
11+
"index": "index.html",
12+
"main": "main.server.ts",
13+
"tsconfig": "tsconfig.server.json",
14+
"prefix": "app"
15+
}
16+
]
17+
}

test/universal-test/.gitignore

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/dist-server
5+
/tmp
6+
/out-tsc
7+
8+
# dependencies
9+
/node_modules
10+
11+
# IDEs and editors
12+
/.idea
13+
.project
14+
.classpath
15+
.c9/
16+
*.launch
17+
.settings/
18+
*.sublime-workspace
19+
20+
# IDE - VSCode
21+
.vscode/*
22+
!.vscode/settings.json
23+
!.vscode/tasks.json
24+
!.vscode/launch.json
25+
!.vscode/extensions.json
26+
27+
# misc
28+
/.sass-cache
29+
/connect.lock
30+
/coverage
31+
/libpeerconnection.log
32+
npm-debug.log
33+
testem.log
34+
/typings
35+
yarn-error.log
36+
37+
# e2e
38+
/e2e/*.js
39+
/e2e/*.map
40+
41+
# System Files
42+
.DS_Store
43+
Thumbs.db

test/universal-test/package.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "universal-test",
3+
"version": "0.0.0",
4+
"license": "MIT",
5+
"scripts": {
6+
"prerender": "ng build --prod --output-hashing=false && node prerender"
7+
},
8+
"private": true,
9+
"dependencies": {
10+
"@angular/animations": "^4.2.4",
11+
"@angular/common": "^4.2.4",
12+
"@angular/compiler": "^4.2.4",
13+
"@angular/core": "^4.2.4",
14+
"@angular/forms": "^4.2.4",
15+
"@angular/http": "^4.2.4",
16+
"@angular/platform-browser": "^4.2.4",
17+
"@angular/platform-browser-dynamic": "^4.2.4",
18+
"@angular/router": "^4.2.4",
19+
"core-js": "^2.4.1",
20+
"rxjs": "^5.4.2",
21+
"zone.js": "^0.8.14"
22+
},
23+
"devDependencies": {
24+
"@angular/cli": "1.3.2",
25+
"@angular/compiler-cli": "^4.2.4",
26+
"@angular/language-service": "^4.2.4",
27+
"@angular/platform-server": "^4.3.6",
28+
"typescript": "~2.3.3"
29+
}
30+
}

0 commit comments

Comments
 (0)