How to use @delon/mock - 10 common examples

To help you get started, we’ve selected a few @delon/mock examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dotnetcore / OSharp / tests / web / ui / ng-alain7 / src / app / delon.module.ts View on Github external
/**
 * 进一步对基础模块的导入提炼
 * 有关模块注册指导原则请参考:https://github.com/ng-alain/ng-alain/issues/180
 */
import { NgModule, Optional, SkipSelf, ModuleWithProviders } from '@angular/core';
import { throwIfAlreadyLoaded } from '@core';

import { AlainThemeModule } from '@delon/theme';

// #region mock
import { DelonMockModule } from '@delon/mock';
import * as MOCKDATA from '../../_mock';
import { environment } from '@env/environment';
const MOCK_MODULES = !environment.production
  ? [DelonMockModule.forRoot({ data: MOCKDATA })]
  : [];
// #endregion

// #region reuse-tab
/**
 * 若需要[路由复用](https://ng-alain.com/components/reuse-tab)需要:
 * 1、增加 `REUSETAB_PROVIDES`
 * 2、在 `src/app/layout/default/default.component.html` 修改:
 *  ```html
 *  <section class="alain-default__content">
 *    
 *    
 *  </section>
 *  ```
 */
import { RouteReuseStrategy } from '@angular/router';
github dotnetcore / OSharp / tests / web / ui / ng-alain8 / src / app / delon.module.ts View on Github external
/**
 * 进一步对基础模块的导入提炼
 * 有关模块注册指导原则请参考:https://ng-alain.com/docs/module
 */
import { NgModule, Optional, SkipSelf, ModuleWithProviders } from '@angular/core';
import { throwIfAlreadyLoaded } from '@core';

import { AlainThemeModule } from '@delon/theme';

// #region mock
import { DelonMockModule } from '@delon/mock';
import * as MOCKDATA from '../../_mock';
import { environment } from '@env/environment';
const MOCK_MODULES = true ? [DelonMockModule.forRoot({ data: MOCKDATA })] : [];
// #endregion

// #region reuse-tab
/**
 * 若需要[路由复用](https://ng-alain.com/components/reuse-tab)需要:
 * 1、增加 `REUSETAB_PROVIDES`
 * 2、在 `src/app/layout/default/default.component.html` 修改:
 *  ```html
 *  <section class="alain-default__content">
 *    
 *    
 *  </section>
 *  ```
 */
import { RouteReuseStrategy } from '@angular/router';
import { ReuseTabService, ReuseTabStrategy } from '@delon/abc/reuse-tab';
github ng-alain / delon / src / app / delon.module.ts View on Github external
return Object.assign(new STConfig(), {
    ps: 3,
  });
}

export function fnLodopConfig(): LodopConfig {
  return Object.assign(new LodopConfig(), {
    license: `A59B099A586B3851E0F0D7FDBF37B603`,
    licenseA: `C94CEE276DB2187AE6B65D56B3FC2848`,
  });
}

// #endregion

@NgModule({
  imports: [AlainThemeModule.forRoot(), DelonFormModule.forRoot(), DelonACLModule.forRoot(), DelonMockModule.forRoot({ data: MOCKDATA })],
})
export class DelonModule {
  constructor(
    @Optional()
    @SkipSelf()
    parentModule: DelonModule,
  ) {
    throwIfAlreadyLoaded(parentModule, 'DelonModule');
  }

  static forRoot(): ModuleWithProviders {
    return {
      ngModule: DelonModule,
      providers: [...REUSETAB_PROVIDES, { provide: STConfig, useFactory: fnSTConfig }, { provide: LodopConfig, useFactory: fnLodopConfig }],
    };
  }
github personball / abplus-zero-template / angular / src / app / delon.module.ts View on Github external
/**
 * 进一步对基础模块的导入提炼
 * 有关模块注册指导原则请参考:https://github.com/ng-alain/ng-alain/issues/180
 */
import { NgModule, Optional, SkipSelf, ModuleWithProviders } from '@angular/core';
import { throwIfAlreadyLoaded } from '@core';

import { AlainThemeModule } from '@delon/theme';

// #region mock
import { DelonMockModule } from '@delon/mock';
import * as MOCKDATA from '../../_mock';
import { environment } from '@env/environment';
const MOCK_MODULES = !environment.production
  ? [DelonMockModule.forRoot({ data: MOCKDATA })]
  : [];
// #endregion

// #region reuse-tab
/**
 * 若需要[路由复用](https://ng-alain.com/components/reuse-tab)需要:
 * 1、增加 `REUSETAB_PROVIDES`
 * 2、在 `src/app/layout/default/default.component.html` 修改:
 *  ```html
 *  <section class="alain-default__content">
 *    
 *    
 *  </section>
 *  ```
 */
import { RouteReuseStrategy } from '@angular/router';
github dotnetcore / OSharp / samples / web / ui-clients / ng-alain8 / src / app / delon.module.ts View on Github external
/**
 * 进一步对基础模块的导入提炼
 * 有关模块注册指导原则请参考:https://ng-alain.com/docs/module
 */
import { NgModule, Optional, SkipSelf, ModuleWithProviders } from '@angular/core';
import { throwIfAlreadyLoaded } from '@core';

import { AlainThemeModule } from '@delon/theme';

// #region mock
import { DelonMockModule } from '@delon/mock';
import * as MOCKDATA from '../../_mock';
import { environment } from '@env/environment';
const MOCK_MODULES = true ? [DelonMockModule.forRoot({ data: MOCKDATA })] : [];
// #endregion

// #region reuse-tab
/**
 * 若需要[路由复用](https://ng-alain.com/components/reuse-tab)需要:
 * 1、增加 `REUSETAB_PROVIDES`
 * 2、在 `src/app/layout/default/default.component.html` 修改:
 *  ```html
 *  <section class="alain-default__content">
 *    
 *    
 *  </section>
 *  ```
 */
import { RouteReuseStrategy } from '@angular/router';
import { ReuseTabService, ReuseTabStrategy } from '@delon/abc/reuse-tab';
github personball / abplus-zero-template / angular / _mock / _apis.ts View on Github external
    '/api/403': () => { throw new MockStatusError(403); },
    '/api/404': () => { throw new MockStatusError(404); },
github personball / abplus-zero-template / angular / _mock / _apis.ts View on Github external
    '/api/401': () => { throw new MockStatusError(401); },
    '/api/403': () => { throw new MockStatusError(403); },
github ng-alain / delon / _mock / user.ts View on Github external
'/500': () => {
    throw new MockStatusError(500);
  },
  '/404': () => {

@delon/mock

Generate random data, intercept http requests.

MIT
Latest version published 2 months ago

Package Health Score

76 / 100
Full package analysis