This file contains hidden or 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
| interface Window { | |
| title: string; | |
| } | |
| interface Window { | |
| ts: TypeScriptAPI; | |
| } | |
| const src = 'const a = "Hello World"'; | |
| window.ts.transpileModule(src, {}); |
This file contains hidden or 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
| interface Animal { | |
| name: string; | |
| } | |
| interface Bear extends Animal { | |
| honey: boolean; | |
| } | |
| // Görüldüğü üzere bir Bear tipinde bir variable artık hem animal hem de | |
| // bear tipindeki propertylere erişebilmekte. |
This file contains hidden or 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
| interface Person { | |
| name: string; | |
| age: number; | |
| } | |
| let person: Person = { | |
| name: "John Doe", | |
| age: 30, | |
| }; | |
| function getPerson(id: number): Person { |
This file contains hidden or 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
| interface Person { | |
| name: string; | |
| age: number; | |
| } | |
| interface Address { | |
| street: string; | |
| city: string; | |
| postalCode: number; | |
| } |
This file contains hidden or 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
| let person: Person = { | |
| name: "John Doe", | |
| age: 30, | |
| }; | |
| // Aşağıdaki fonksiyon Person tipinde bir variable döndürmelidir. | |
| function getPerson(id: number): Person { | |
| // ... | |
| } |
This file contains hidden or 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
| //Örnek1: | |
| type Person = { | |
| name: string; | |
| age: number; | |
| }; | |
| //Örnek2: | |
| type Address = { |
This file contains hidden or 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
| let num: number = 10; | |
| // num değişkeni number türünde ve 10 değerine sahip | |
| const str: string = "Merhaba Dünya!"; | |
| // str sabiti string türünde ve "Merhaba Dünya!" değerine sahip |
This file contains hidden or 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 { CanActivateFn } from '@angular/router'; | |
| const myGuard: CanActivateFn = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => { | |
| // Burada kendi guard mantığınızı oluşturmalısınız | |
| return true; | |
| } |
This file contains hidden or 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 { Routes, RouterModule } from '@angular/router'; | |
| import { HomeComponent } from './home/home.component'; | |
| import { AboutComponent } from './about/about.component'; | |
| import { UserComponent } from './user/user.component'; | |
| import { AuthGuard } from './auth.guard'; | |
| import { ConfirmDeactivateGuard } from './confirm-deactivate.guard'; | |
| import { CanLoadGuard } from './can-load.guard'; | |
| const routes: Routes = [ |
This file contains hidden or 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 { CanLoad, Route, UrlSegment } from '@angular/router'; | |
| import { Observable } from 'rxjs'; | |
| @Injectable({ | |
| providedIn: 'root' | |
| }) | |
| export class AuthGuard implements CanLoad { | |
| canLoad( | |
| route: Route, |