Hello World
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express=require('express'); | |
const app = express(); | |
const http = require('http').Server(app); | |
const io = require('socket.io')(http); | |
const balls = []; | |
app.use(express.static(__dirname+'/public')) | |
app.get('/', function (req, res) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var btnJoin; | |
var socket = io.connect('http://localhost:3000/'); | |
socket.on('newBall', function (data) { | |
addBall(data); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { AngularFirestore, AngularFirestoreCollection } from '@angular/fire/firestore'; | |
import { Category } from '../models/category.model'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class CategoryService { | |
constructor(private fireStore: AngularFirestore) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AngularFirestore, AngularFirestoreCollection } from '@angular/fire/firestore'; | |
import { Injectable } from '@angular/core'; | |
import { Book } from "../models/book.model"; | |
import { Category } from '../models/category.model'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class BookService { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit, ViewChild, ElementRef } from '@angular/core'; | |
import { BookService } from './services/book.service'; | |
import { Book } from './models/book.model'; | |
import { CategoryService } from './services/category.service'; | |
import { Category } from './models/category.model'; | |
import { SwalComponent } from '@sweetalert2/ngx-sweetalert2'; | |
import { MatDialog } from '@angular/material/dialog'; | |
import { BookDialogComponent } from './components/book-dialog/book-dialog.component'; | |
import { AddbookDialogComponent } from './components/addbook-dialog/addbook-dialog.component'; | |
import { AddcategoryDialogComponent } from './components/addcategory-dialog/addcategory-dialog.component'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="container"> | |
<div class="category-list"> | |
<mat-button-toggle-group #categoryGroup="matButtonToggleGroup"> | |
<mat-button-toggle [value]="category.Name" *ngFor="let category of categories"> | |
{{category.Name}} | |
</mat-button-toggle> | |
</mat-button-toggle-group> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div mat-dialog-content class="book-dialog-content"> | |
<form [formGroup]="addBookForm" class="add-book-form"> | |
<mat-form-field> | |
<input formControlName="bookName" matInput placeholder="Book Name" required > | |
</mat-form-field> | |
<mat-form-field> | |
<input matInput formControlName="bookAuthor" placeholder="Book Author" required> | |
</mat-form-field> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit, Inject } from '@angular/core'; | |
import { FormGroup, FormBuilder, FormControl, FormArray } from '@angular/forms'; | |
import { Category } from 'src/app/models/category.model'; | |
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material'; | |
import { BookService } from 'src/app/services/book.service'; | |
import { Book } from 'src/app/models/book.model'; | |
@Component({ | |
selector: 'app-addbook-dialog', | |
templateUrl: './addbook-dialog.component.html', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="book-form-categories" formArrayName="bookCategories" | |
*ngFor="let item of addBookForm.get('bookCategories')['controls']; let i = index;"> | |
<mat-form-field [formGroupName]="i" class="book-form-category"> | |
<mat-label>Book Category</mat-label> | |
<mat-select formControlName="bookCategory" required> | |
<mat-option *ngFor="let category of data" [value]="category.Name"> | |
{{category.Name}} | |
</mat-option> | |
</mat-select> | |
</mat-form-field> |
OlderNewer