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 element = document.querySelector('.element'); | |
// Элемент-контейнер после которого мы вставим контент | |
const parentElement = document.querySelector('.parent-element'); | |
// Вставка | |
parentElement.after(element) |
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
beforeEach(async(() => { | |
TestBed.configureTestingModule({ | |
imports: [ | |
MdToolbarModule, | |
], | |
providers: [ | |
{ | |
provide: Router, | |
useClass: MockRouter, | |
}, |
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 { InsideLayoutComponent } from './core/inside-layout/inside-layout.component'; | |
const AppRouter: Routes = [ | |
{ | |
path: '', component: InsideLayoutComponent, children: [ | |
{ | |
path: 'black-market', loadChildren: './modules/market/market.module#MarketModule' | |
}, |
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 { HttpClient } from '@angular/common/http'; | |
import { environment } from '../../../environments/environment'; | |
@Injectable() | |
export class HttpCallService { | |
link = environment.serverDomain; | |
constructor(private httpClient: HttpClient) {} |
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 {ApiAuthService} from './api-auth.service'; | |
import {HttpRequest, HttpEvent, HttpHandler, HttpInterceptor} from '@angular/common/http'; | |
import {Injectable} from '@angular/core'; | |
import {Observable} from 'rxjs/Observable'; | |
@Injectable() | |
export class AuthInterceptor implements HttpInterceptor { | |
constructor(private authService: ApiAuthService) {} | |
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { | |
const copiedAuthRequest = req.clone({ |
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
@Component({ | |
selector: 'sample', | |
template: ` | |
<span #tref>I am span</span> | |
` | |
}) | |
export class SampleComponent implements AfterViewInit { | |
@ViewChild("tref", {read: ElementRef}) tref: ElementRef; | |
ngAfterViewInit(): 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
import { NgModule } from '@angular/core'; | |
import { RouterModule, Routes } from '@angular/router'; | |
import { AdvComponent } from './adv.component'; | |
const routes: Routes = [ | |
{ | |
path: ':id', component: AdvComponent | |
} | |
]; |
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
@media (min-width: 1440px) {} | |
@media (max-width: 1440px) {} | |
@media (max-width: 1200px) {} | |
@media (max-width: 1024px) {} | |
@media (max-width: 768px) {} | |
@media (max-width: 425px) {} | |
@media (max-width: 375px) {} | |
@media (max-width: 320px) {} |
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 { CanActivate } from '@angular/router'; | |
@Injectable() | |
export class AuthGuard implements CanActivate { | |
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean>|Promise<boolean>|boolean { | |
return 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
<form [formGroup]="form" (submit)="onSubmit()"> | |
<input type="text" formControlName="title"> | |
<button type="submit" [disabled]="form.invalid">Сохранить объявление</button> | |
</form> |
NewerOlder