0.3.2 • Published 5 years ago

ngx-oxford v0.3.2

Weekly downloads
44
License
SEE LICENSE IN LI...
Repository
github
Last release
5 years ago

Oxford

Comma separated lists without the hassle or hubbub!

Oxford renders comma-separated lists in Angular templates for you. Just give it a list of items and a conjunction (e.g. 'and', 'or', 'nor', 'and/or', etc).

Use it as a pipe or component, and stop worrying about how many items you have, getting spacing right, etc. For example:

[]                       ⇢  ""
['bunny']                ⇢  "bunny"
['bunny', 'cat']         ⇢  "bunny and cat"
['bunny', 'cat', 'dog']  ⇢  "bunny, cat, and dog"

Install it

Install ngx-oxford from npm:

npm i -s ngx-oxford

Then add OxfordModule to your imports:

import { OxfordModule } from 'ngx-oxford';

@NgModule({
  ...
  imports: [
    OxfordModule,
  ],
  ...
})

Use it

...as a pipe

For simple text lists:

"{{ list | oxford:'and' }}"

...as a component

For HTML, links, style, etc:

"<ng-container *ngFor="let x of list; let i = index">
  <a [href]="'https://www.google.com/search?q=' + x">{{ '{{' }} x }}</a>
  <ngx-oxford [index]="i" [length]="list.length">or</ngx-oxford> </ng-container
>"

Future

  • Get it working as an structural directive. E.g. *ngFor="let x of list; oxford: 'and'". Help?
0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago

0.0.1

5 years ago