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 { Entity, PrimaryGeneratedColumn, Column, BaseEntity } from 'typeorm'; | |
import { ObjectType, Field, ID, Int, ArgsType, InputType } from 'type-graphql'; | |
@Entity() | |
@ObjectType() | |
export class Book extends BaseEntity { | |
@PrimaryGeneratedColumn("uuid") | |
@Field(type => ID) | |
id: string; |
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 } from '@angular/core'; | |
import { MatSnackBar } from '@angular/material'; | |
import { Router } from '@angular/router'; | |
import { slugify } from '../../helpers/slugify'; | |
import { SEOService } from '../../services/seo.service'; | |
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; | |
import { MustMatch } from '../../helpers/must-match-validator'; | |
import { MAT_MOMENT_DATE_FORMATS, MomentDateAdapter } from '@angular/material-moment-adapter'; |
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 { NgModule } from '@angular/core'; | |
import { RouterModule, Routes } from '@angular/router'; | |
import { CanActivateRouteGuardService } from './services/can-activate-route-guard.service'; | |
import { CantActivateRouteGuardService } from './services/cant-activate-route-guard.service'; | |
const routes: Routes = [ | |
{ | |
path: 'login', | |
loadChildren: './components/login-page/login-page.module#LoginPageModule', |
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 } from '@angular/core'; | |
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; | |
@Component({ | |
selector: 'app-form', | |
templateUrl: './form.component.html', | |
styleUrls: ['./form.component.scss'] | |
}) | |
export class FormComponent implements OnInit { |
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
# Angular 8 Events Cheet-sheet | |
(drag)="myFunction()" | |
(drop)="myFunction()" | |
(dragover)="myFunction()" | |
(blur)="someFunction()" | |
(focus)="someFunction()" | |
(scroll)="someFunction()" |
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 *ngIf="user && meQuery$ | async as meQuery" class="reader-up container" fxLayout="row" fxLayoutAlign="space-between"> | |
<div *ngIf="user.id === meQuery.me.id"> | |
<button>PROFİLİMİ GÜNCELLE</button> | |
</div> | |
.... other components..... | |
</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
ngOnInit() { | |
this.route.params.subscribe(params => { | |
this.getUser(params.slug); | |
}); | |
} | |
getUser(slug: string) { | |
this.user$ = this.userPageUserGQL | |
.watch({ slug: slug }, { |
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, OnDestroy } from '@angular/core'; | |
import { ActivatedRoute } from '@angular/router'; | |
import { UserPageUserQuery, UserPageUserGQL, LoginPageMeQuery, LoginPageMeGQL } from '@generated-types'; | |
import { Observable, Subscription } from 'rxjs'; | |
import { map } from 'rxjs/operators'; | |
import { SEOService } from '@services/seo.service'; | |
import { FaIconLibrary } from '@fortawesome/angular-fontawesome'; | |
import { fas, faCoffee } from '@fortawesome/free-solid-svg-icons'; | |
import { far } from '@fortawesome/free-regular-svg-icons'; | |
import { fab } from '@fortawesome/free-brands-svg-icons'; |
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="role-badge" [ngClass]="{ | |
'green': user.role === 'ADMIN', | |
'blue': user.role === 'MODERATOR', | |
'black': user.role === 'MEMBER' | |
}">{{ user.role }}</div> |