### Instruction:
Develop a TypeScript web application using Angular framework that connects to a Firebase Realtime Database and displays a list of chat messages. Allow users to sign in using Google authentication, send new messages, and receive real-time updates when other users post messages. Implement pagination for loading older messages and proper escaping of special characters in message content.

### Response:

To create a TypeScript web application using Angular and Firebase Realtime Database, follow these steps:

1. Install Node.js and npm
Download and install the latest version of Node.js from https://nodejs.org/. This will also install npm (Node Package Manager).

2. Install Angular CLI
Open your terminal or command prompt and run the following command to install Angular CLI globally:
```
npm install -g @angular/cli
```

3. Create a new Angular project
Create a new Angular project by running the following command in your terminal:
```
ng new angular-firebase-chat
```
Navigate to the newly created folder:
```
cd angular-firebase-chat
```

4. Install Firebase and AngularFire libraries
Run the following commands to install Firebase and AngularFire libraries for Angular:
```
npm install firebase @angular/fire --save
```

5. Set up Firebase
Go to https://firebase.google.com/ and sign in with your Google account. Click on "Get started" and create a new project. After creating the project, click on "Add Firebase to your web app" and copy the configuration object.

6. Add Firebase configuration to environment files
In your Angular project, open `src/environments/environment.ts` and `src/environments/environment.prod.ts`. Add your Firebase configuration object to both files like this:
```typescript
export const environment = {
  production: false,
  firebaseConfig: {
    apiKey: 'your-api-key',
    authDomain: 'your-auth-domain',
    databaseURL: 'your-database-url',
    projectId: 'your-project-id',
    storageBucket: 'your-storage-bucket',
    messagingSenderId: 'your-messaging-sender-id',
    appId: 'your-app-id'
  }
};
```

7. Initialize Firebase in AppModule
Open `src/app/app.module.ts` and import the necessary modules:
```typescript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AngularFireModule } from '@angular/fire';
import { AngularFireAuthModule } from '@angular/fire/auth';
import { AngularFireDatabaseModule } from '@angular/fire/database';
import { environment } from '../environments/environment';

import { AppComponent } from './app.component';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AngularFireModule.initializeApp(environment.firebaseConfig),
    AngularFireAuthModule,
    AngularFireDatabaseModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
```

8. Create a ChatService
Generate a new service called `ChatService` by running the following command:
```
ng generate service chat
```
Open `src/app/chat.service.ts` and implement the methods for authentication, sending messages, and receiving messages:

```typescript
import { Injectable } from '@angular/core';
import { AngularFireAuth } from '@angular/fire/auth';
import { AngularFireDatabase } from '@angular/fire/database';
import firebase from 'firebase/app';
import { Observable } from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class ChatService {
  constructor(private afAuth: AngularFireAuth, private db: AngularFireDatabase) {}

  // Sign in with Google
  signInWithGoogle(): Promise<firebase.auth.UserCredential> {
    return this.afAuth.signInWithPopup(new firebase.auth.GoogleAuthProvider());
  }

  // Sign out
  signOut(): Promise<void> {
    return this.afAuth.signOut();
  }

  // Get current user
  getCurrentUser(): Observable<firebase.User | null> {
    return this.afAuth.authState;
  }

  // Send message
  sendMessage(content: string): Promise<void> {
    const userId = this.afAuth.currentUser?.uid || '';
    const userName = this.afAuth.currentUser?.displayName || 'Anonymous';
    const message = { userId, userName, content, timestamp: firebase.database.ServerValue.TIMESTAMP };
    return this.db.list('/messages').push(message);
  }

  // Get messages
  getMessages(limit: number): Observable<any[]> {
    return this.db.list('/messages', ref => ref.orderByChild('timestamp').limitToLast(limit)).valueChanges();
  }
}
```

9. Create a ChatComponent
Generate a new component called `ChatComponent` by running the following command:
```
ng generate component chat
```
Open `src/app/chat/chat.component.ts` and implement the methods for signing in, signing out, sending messages, and receiving messages:

```typescript
import { Component, OnInit } from '@angular/core';
import { ChatService } from '../chat.service';

@Component({
  selector: 'app-chat',
  templateUrl: './chat.component.html',
  styleUrls: ['./chat.component.css']
})
export class ChatComponent implements OnInit {
  user: any;
  messages: any[] = [];
  messageContent = '';

  constructor(private chatService: ChatService) {}

  ngOnInit(): void {
    this.chatService.getCurrentUser().subscribe(user => {
      this.user = user;
    });

    this.chatService.getMessages(10).subscribe(messages => {
      this.messages = messages;
    });
  }

  signInWithGoogle(): void {
    this.chatService.signInWithGoogle();
  }

  signOut(): void {
    this.chatService.signOut();
  }

  sendMessage(): void {
    if (this.messageContent.trim() !== '') {
      this.chatService.sendMessage(this.messageContent);
      this.messageContent = '';
    }
  }
}
```

10. Update the ChatComponent template
Open `src/app/chat/chat.component.html` and add the following code to display the chat interface:

```html
<div *ngIf="!user">
  <button (click)="signInWithGoogle()">Sign in with Google</button>
</div>

<div *ngIf="user">
  <h2>Welcome, {{ user.displayName }}</h2>
  <button (click)="signOut()">Sign out</button>

  <ul>
    <li *ngFor="let message of messages">
      <strong>{{ message.userName }}:</strong> {{ message.content }}
    </li>
  </ul>

  <input [(ngModel)]="messageContent" placeholder="Type your message here...">
  <button (click)="sendMessage()">Send</button>
</div>
```

11. Update AppComponent template
Open `src/app/app.component.html` and replace its content with the following code to display the ChatComponent:

```html
<app-chat></app-chat>
```

12. Run the application
Run the following command in your terminal to start the development server:
```
ng serve
```
Now you can open your browser and navigate to http://localhost:4200/ to see your chat application.

This is a basic implementation of a chat application using Angular and Firebase Realtime Database. You can further enhance it by implementing pagination for loading older messages and proper escaping of special characters in message content.