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
function pullOut(array &$arr, ...$parameters) | |
{ | |
$result = []; | |
foreach ($parameters as $key => $parameter) { | |
$result[$key] = $arr[$parameter]; | |
unset($arr[$parameter]); | |
} | |
return $result; | |
} |
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
// load data by another event (on parent change) | |
$("#parent").on("change", function (e) { | |
$.ajax({ | |
url: '/api' + e.target.value, | |
dataType: "json", | |
success: function (data) { | |
$("#child").select2({ | |
data: data, | |
allowClear:true, |
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
// fixed width and height | |
$('#banner').cropper({ | |
movable: false, | |
resizable: false, | |
rotatable: false, | |
dragCrop: false, | |
dragMode: 'move', | |
cropBoxResizable: false, | |
responsive: true, |
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
this.authService.login(request) | |
.subscribe((response) => { | |
localStorage.setItem('access_token', response.token); | |
this.router.navigate('/') | |
}); |
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 { Observable } from 'rxjs'; | |
import { Injectable } from '@angular/core'; | |
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http'; | |
export function appendToken(req: HttpRequest<any>, token: string) { | |
return req.clone({ | |
headers: req.headers.set('Authorization', `Bearer ${token}`) | |
}); | |
} |
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
// HTTP_INTERCEPTORS injection token'ini import etmeyi unutmayın! | |
import { HTTP_INTERCEPTORS } from '@angular/common/http'; | |
@NgModule({ | |
declarations: [ | |
AppComponent, | |
], | |
imports: [ | |
CoreModule, | |
AppRoutingModule |
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
// Imports | |
@Injectable({ providedIn: 'root' }) | |
export class ErrorHandlerInterceptor implements HttpInterceptor { | |
constructor(private readonly validationErrorService: ValidationErrorsService) { | |
} | |
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { | |
return next.handle(req) | |
.pipe(catchError(event => { |
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
// Imports.. | |
@Injectable({ providedIn: 'root' }) | |
export class ElasticLogInterceptor implements HttpInterceptor { | |
constructor(private logger: ElasticService) { | |
} | |
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { | |
return next.handle(request) | |
.pipe( |
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
export declare interface ControlValueAccessor { | |
writeValue(obj: any): void; | |
registerOnChange(fn: any): void; | |
registerOnTouched(fn: any): void; | |
setDisabledState?(isDisabled: boolean): void; | |
} |
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
setDisabledState(isDisabled: boolean): void { | |
this.renderer.setProperty(this.input.nativeElement, 'disabled', isDisabled); | |
} |
OlderNewer