项目作者: sujeet100

项目描述 :
An angularJS directive for adding facebook like hashtags highlight supported content editable container
高级语言: JavaScript
项目地址: git://github.com/sujeet100/ngHashtags.git
创建时间: 2017-01-12T07:22:18Z
项目社区:https://github.com/sujeet100/ngHashtags

开源协议:MIT License

下载


ngHashtags

A simple angularJS directive to include facebook like hashtag highlight enabled editable container.

Screenshots

Screenshot

Live demo

Live demo on JSFiddle

Requirementst

  • AngularJS
  • Modern Browser supporting Contenteditable

Installing

Download

Add files

Add the scripts to your application. Make sure the ngHashtags.js file is inserted after the angular.js library:

  1. <script src="angular.js"></script>
  2. <script src="ngHashtags.js"></script>
  3. <link rel="stylesheet" type="text/css" href="ngHashtags.css">

Add a dependancy

Add the ngHashtags module as a dependancy to your application module:

  1. var myAppModule = angular.module('MyApp', ['ngHashtags']);

Usage

  1. Add the ngHashtags directive on a Div container to make it content editable with support for hashtags highlight
  2. Bind a model to the container using ng-model proeprty
  3. Done!

Example code

The following code makes a div content editable and highlights any hashtags if found.
The highlight style can be overriden using ‘tags-highlight’ css class.
The defualt highlight style is similar to the facebook hashtags highlight style.

  1. <div ng-hashtags ng-model="model" placeholder="Enter space separated hashtags e.g. #coffee #burger"></div>
  2. </html>

License

See the LICENSE file.