Getting Started


@delon/mock is a simulation data generator to help the front-end to develop and prototype separate from the back-end progress and reduce some monotony particularly while writing automated tests.


  • All of the Angular projects

  • Unobtrusive

  • Simple usage

  • Support mock.js


Install @delon/mock from yarn.

yarn add @delon/mock -D

Please refer to global-config.module.ts import the Mock Rule data.


You can override them via Global Configuration.

PropertyDescriptionTypeDefaultGlobal Config
[data]any-Mock data rule
[delay]number300Request delay, unit is milliseconds
[force]booleanfalseWhether to force all requests to Mock, true means to return a 404 error directly when the requested URL does not exist, false means to send a real HTTP request when the request is missed
[log]booleantrueWhether to print Mock request information, make up for the browser without Network information; it will output 👽Mock when hit
[executeOtherInterceptors]booleantrueWhether continue to call other interceptor intercept method after mock rule hit
[copy]booleantrueWhether to return copy data

Lazy modules need to import forChild, You can import forChild in the SharedModule.