- Soft Delete
- Backup
- Restore
- Test
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 {Directive, ElementRef, Input, OnChanges, OnInit, Renderer2} from '@angular/core'; | |
@Directive({ | |
// tslint:disable-next-line:directive-selector | |
selector: '[ngxLoading]' | |
}) | |
export class LoadingBtnDirective implements OnInit, OnChanges { | |
@Input() textLoading: string; | |
@Input() textInitial: string; |
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 { Component, OnDestroy, OnInit, VERSION } from "@angular/core"; | |
import { SharedService } from "./shared.service"; | |
@Component({ | |
selector: "my-app", | |
templateUrl: "./app.component.html", | |
styleUrls: ["./app.component.css"] | |
}) | |
export class AppComponent implements OnInit, OnDestroy { | |
/** |
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
const routes: Routes = [ | |
{ | |
path: '', | |
component: HomeComponent, | |
children: [ | |
{ | |
path: 'auth', | |
loadChildren: './modules/auth/auth.module#AuthModule' | |
}, | |
{ |
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 { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http'; | |
import { Observable } from 'rxjs'; | |
@Injectable() | |
export class AuthInterceptor implements HttpInterceptor { | |
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { | |
const token = localStorage.getItem('auth_token'); | |
if (!token) { | |
return next.handle(req); | |
} |
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 implements OnInit { | |
public data$: Observable<any>; | |
ngOnInit(): void { | |
this.data$ = this.rest.get(`http://api-data.com`) | |
} | |
} |
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
<ul> | |
<li *ngFor="let item of data$ | async"> | |
{{item}} | |
</li> | |
</ul> |
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
search = (q: string, exportData = false, limit = 0) => { | |
this.results$.total = 0; | |
if (q.length > 2) { | |
this.results$.q = q; | |
this.loading = true; | |
const url = (exportData) ? `overview/search?q=${q}&export=xlsx&limit=${limit}` : `overview/search?q=${q}`; | |
this.results$.docs = this.rest.get(url, | |
true, {ignoreLoadingBar: ''}) | |
.pipe( |
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
if (environment.production) { | |
enableProdMode(); | |
if (window) { | |
window.console.log = window.console.warn = window.console.info = function () { | |
// Don't log anything. | |
}; | |
const w = window as any; | |
window.console.error = function ($event, more) { | |
console.log(' 😠 ERROR', more) |
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
// Se debe obtener la fecha en formato YYYY/MM/DD muy importante usar '/' para separar | |
const start = moment.utc('2020-07-13T14:04:45.098Z').format('YYYY/MM/DD') // 2020/07/13 | |
// Luego se debe volver a parsear indicando los '/' | |
moment(start, 'YYYY/MM/DD').toDate() //2020/07/13 :) |