1.8.4 • Published 4 years ago

fvi-angular-mentions v1.8.4

Weekly downloads
198
License
MIT
Repository
github
Last release
4 years ago

Angular Mentions - Francis fork

Forked from dmacfarlane/angular-mentions

Forked from dessalines/angular-mentions

Angular mentions inspired by Ment.io.

Provides auto-complete suggestions for @mentions in text input fields, text areas, and content editable fields. Not fully browser tested and comes without warranty!

git clone https://github.com/francisvgi/fvi-angular-mentions.git cd angular-mentions ng serve

Usage

Add the package as a dependency to your project using:

npm install --save fvi-angular-mentions

Add the CSS to your index.html:

<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">

Add the module to your app.module imports:

import { MentionModule } from 'fvi-angular-mentions/mention';
...

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

Add the [mentions] directive to your input element:

<input type="text" [mentions]="mentionItems">

Where mentionItems is an an array of MentionItem:

mentionItems: Array<MentionItem> = [
    {
      items: {"jerry", "ben", "tom"},
      triggerChar: '@',
	  mentionSelect: formatMention
    },
    {
      items: {"happy", "sad", "trending"},
      triggerChar: '#',
    },
    {
      items: [
        {
          id: 1,
          name: "community_A"
        },
        {
          id: 2,
          name: "community_B"
        }
      ],
      labelKey: "name",
      triggerChar: "~"
    }
  ];

Configuration Options

export interface MentionItem {

  // The list of items to be searched on.
  items: Array<{}>;

  // the character that will trigger the menu behavior
  triggerChar: string;

  // option to specify the field in the objects to be used as the item label
  labelKey?: string;

  // option to limit the number of items shown in the pop-up menu
  maxItems?: number;

  // option to diable internal filtering. can be used to show the full list returned
  // from an async operation (or allows a custom filter function to be used - in future)
  disableSearch?: boolean;

  // template to use for rendering list items
  mentionListTemplate?: TemplateRef<any>;

  // internal use
  searchList? : MentionListComponent;
  
  // optional function to format the selected item before inserting the text
  selectMention? : any;
}

Output Events

  • (searchTerm)="" event emitted whenever the search term changes. Can be used to trigger async search.

  • (selectedTerm)="" event emitted whenever a term is selected.

THANKS TO DESSALINES (https://github.com/dessalines/angular-mentions) AND DMACFARLANE(https://github.com/dmacfarlane/angular-mentions).

1.8.4

4 years ago

1.8.3

4 years ago

1.8.2

4 years ago

1.8.1

4 years ago

1.8.0

4 years ago

1.7.0

4 years ago

1.6.0

4 years ago

1.4.0

4 years ago

1.5.0

4 years ago

1.3.0

4 years ago

1.2.7

4 years ago

1.2.6

4 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

0.10.8

5 years ago

0.10.6

5 years ago

0.10.4

5 years ago

0.10.2

5 years ago

0.10.1

5 years ago

0.10.0

5 years ago

0.9.93

5 years ago

0.9.91

6 years ago

0.9.9

6 years ago

0.9.7

6 years ago

0.9.6

6 years ago

0.9.5

6 years ago

0.9.4

6 years ago

0.9.3

6 years ago

0.9.2

6 years ago

0.9.1

6 years ago

0.9.0

6 years ago

0.8.48

6 years ago

0.8.47

6 years ago

0.8.46

6 years ago

0.8.45

6 years ago

0.8.42

6 years ago

0.8.41

6 years ago

0.8.40

6 years ago

0.8.35

6 years ago

0.8.32

6 years ago

0.8.31

6 years ago

0.8.30

6 years ago

0.8.29

6 years ago

0.8.28

6 years ago

0.8.27

6 years ago

0.8.26

6 years ago

0.8.25

6 years ago

0.8.24

6 years ago

0.8.22

6 years ago

0.8.21

6 years ago

0.8.20

6 years ago

0.8.19

6 years ago

0.8.18

6 years ago

0.8.17

6 years ago

0.8.16

6 years ago

0.8.15

6 years ago

0.8.14

6 years ago

0.8.13

6 years ago

0.8.12

6 years ago

0.8.11

6 years ago

0.8.10

6 years ago

0.8.9

6 years ago

0.8.8

6 years ago

0.8.7

6 years ago

0.8.6

6 years ago

0.8.5

6 years ago

0.8.4

6 years ago

0.8.3

6 years ago

0.8.2

6 years ago

0.8.0

6 years ago