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
| { | |
| "$schema": "http://json-schema.org/schema", | |
| "id": "my-schematics", | |
| "type": "object", | |
| "properties": { | |
| "path": { | |
| "description": "The path to create the module.", | |
| "type": "string", | |
| "format": "path", | |
| "visible": false |
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
| { | |
| "$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json", | |
| "extends": ["@schematics/angular"], | |
| "schematics": { | |
| "my-schematics": { | |
| "description": "A custom module generator.", | |
| "factory": "./my-schematics/index#mySchematics", | |
| "schema": "./my-schematics/schema.json" | |
| } | |
| } |
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 { Rule, SchematicContext, Tree } from '@angular-devkit/schematics'; | |
| // You don't have to export the function as default. You can also have more than one rule factory | |
| // per file. | |
| export function mySchematics(_options: any): Rule { | |
| return (tree: Tree, _context: SchematicContext) => { | |
| tree.create(_options.name || 'hello', 'world'); | |
| return tree; | |
| }; | |
| } |
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 { Rule, SchematicContext, Tree } from '@angular-devkit/schematics'; | |
| // You don't have to export the function as default. You can also have more than one rule factory | |
| // per file. | |
| export function mySchematics(_options: any): Rule { | |
| return (tree: Tree, _context: SchematicContext) => { | |
| return tree; | |
| }; | |
| } |
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
| { | |
| "$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json", | |
| "schematics": { | |
| "my-schematics": { | |
| "description": "A blank schematic.", | |
| "factory": "./my-schematics/index#mySchematics" | |
| } | |
| } | |
| } |
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
| public getAutoCompleteResult(term: string) { | |
| return this.httpClient | |
| .hideLoader() | |
| .get(`http://my-domain/api/autocomplete`); | |
| } |
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
| providers: [ | |
| { provide: HttpClient, useClass: HttpService }, | |
| ], |
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
| @Injectable() | |
| export class HttpService extends HttpClient { | |
| constructor(private httpHandler: HttpHandler, | |
| private injector: Injector, | |
| @Optional() @Inject(HTTP_DYNAMIC_INTERCEPTORS) private interceptors: HttpInterceptor[] = []) { | |
| super(httpHandler); | |
| if (!this.interceptors) { | |
| // Configure default interceptors that can be disabled here |
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 { InjectionToken } from '@angular/core'; | |
| import { HttpClient, HttpEvent, HttpInterceptor, HttpHandler, HttpRequest } from '@angular/common/http'; | |
| import { Observable } from 'rxjs'; | |
| declare module '@angular/common/http/src/client' { | |
| export interface HttpClient { | |
| hideLoader(hide?: boolean): HttpClient; | |
| } |
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
| declare module '@angular/common/http/src/client' { | |
| export interface HttpClient { | |
| hideLoader(hide?: boolean): HttpClient; | |
| } | |
| } |