Getting started (AngularJS)
npm install --save atmention-angularjs
@import 'node_modules/atmention-angularjs/dist/atmention-angularjs.css'
Add the module to your app
require('angular');
require('atmention-angularjs');
angular.module('app', [
'atmentionModule'
]);
<atmention-textarea
ng-model="$ctrl.markup"
placeholder="Use @ to mention someone">
</atmention-textarea>
<button ng-click="$ctrl.save()">Save</button>
function Controller(atmention) {
$ctrl.markup = 'Nice groove, [Elvin](elvin@example.com)...'
$ctrl.save = function () {
var instance = atmention.parse($ctrl.markup);
instance.getDisplay(); // 'Nice groove, Elvin...'
instance.getMarkup(); // 'Nice groove, [Elvin](elvin@example.com)...'
instance.getMentions(); // [{ label: 'Elvin', value: 'elvin@example.com' }]
};
}