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 { HttpRequest, HttpResponse } from '@angular/common/http'; | |
import { Injectable } from '@angular/core'; | |
import { BehaviorSubject } from 'rxjs'; | |
export interface CachedData { | |
time: number; | |
body: object & HttpResponse<any>; | |
} |
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
export class AppComponent { | |
@HostListener('click', [ | |
'$event.target', | |
'$event.button', | |
'$event.ctrlKey', | |
'$event.metaKey', | |
]) | |
private onClick( | |
eventTarget: HTMLElement, | |
button: 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
import {ApplicationRef, enableProdMode} from '@angular/core'; | |
import {enableDebugTools} from '@angular/platform-browser'; | |
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; | |
import {AppModule} from './app/app.module'; | |
import {environment} from './environments/environment'; | |
import {hmrBootstrap} from './hmr'; | |
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
/* tslint:disable:max-line-length */ | |
import {LongServiceNameService} from '../long/path/to/service/somwhere/in/project/long-service-name.service'; | |
/* tslint:enable:max-line-length */ |
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
/** | |
* Метод возвращает нужный код числительного для разных цифр. | |
* Возможные коды ответа: 1, 2, 5 | |
* Например, 1 - для 1 товар, 2 - товара, 5 - товаров | |
*/ | |
public getPluralCode(n: number): number { | |
return (n % 10 === 1) && (n % 100 !== 11) | |
? 1 | |
: (n % 10 >= 2) | |
&& (n % 10 <= 4) |
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
"ng": "ng", | |
"start": "ng serve --proxy-config proxy.conf.json -sm --aot", | |
"start-hmr": "ng serve --proxy-config proxy.conf.json -sm --hmr -e=hmr", | |
"build-dev": "ng build --dev --op=../../public_html/f/main-dev/ -dop false --oh none -sm false", | |
"build": "ng build --prod --op=../../public_html/f/main/ -dop false --oh none", | |
"test": "ng test --sourcemaps=false", | |
"lint": "ng lint --type-check", | |
"e2e": "ng e2e" |
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
<?php | |
$input = file_get_contents('php://input'); | |
$request = $input ? json_decode($input, true) : $_REQUEST; | |
if ($request['error']) { | |
$logPath = $_SERVER['DOCUMENT_ROOT'] . '/js-log-error.txt'; | |
$date = date('Y.m.d H:i:s'); | |
$message = $date . PHP_EOL . var_export($request, true) . PHP_EOL . PHP_EOL; |
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
export class AppComponent { | |
@HostListener('click', [ | |
'$event.target', | |
'$event.button', | |
'$event.ctrlKey', | |
'$event.metaKey', | |
]) | |
private onClick( | |
eventTarget: HTMLElement, | |
button: 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
`npm install --save-dev @angularclass/hmr` | |
`src/environments/environment.prod.ts` | |
Add rule: `hmr: false` | |
`src/environments/environment.ts` | |
Add rule: `hmr: 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
interface ColorRgb { | |
r: number; | |
g: number; | |
b: number; | |
} | |
interface ColorHsl { | |
h: number; | |
s: number; | |
l: number; |
OlderNewer