Easily use lorem-ipsum dummy texts in your angular app as directive, component or by using a service.
npm install ngx-lipsum







Easily use lorem-ipsum dummy texts in your angular app as directive, component or by using a service.
All generated texts are based on the lorem-ipsum NPM package and it's configuration defined by the ILoremIpsumParams interface.
In most cases this package uses the defaults by passing no further option / an empty object.
This package provides:
- the LipsumService
- the ngx-lipsum-Component that can be used as a standalone Component
- the lipsum-Directive which is also exported as standalone Directive
Using the lipsum-Directive allows you to fill most HTML Elements with _lorem ipsum_ content (some won't make sense like video, audio, iframe, etc.).
By default the generated text will simply be inserted.
The defaults here depending on the target HTML-Element. You can find them at the top of the implementation
``html
$3
You can use the
ngx-lipsum-Component in your template and pass through an optional configuration object as config input property binding.`html
`$3
When you want to use the service to generate a _lorem ipsum_ text in your classes, you need to inject the service and call the
get-method to retrieve the text.
You can pass through any config from the lorem-ipsum NPM package.`ts
import { Component } from '@angular/core';
import { LipsumService } from 'ngx-lipsum';@Component({
selector: 'my-component',
template: '{{ lipsumText }}',
})
export class MyComponent {
public lipsumText: string;
constructor(lipsum: LipsumService) {
this.lipsumText = lipsum.get(/ { count: 3, unit: 'sentences' } /);
}
}
``