GithubHelp home page GithubHelp logo

prashant-shukla / angular-read-more Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ismarslomic/angular-read-more

0.0 2.0 0.0 101 KB

AngularJS Read More Directive - without jQuery dependency

License: BSD 3-Clause "New" or "Revised" License

HTML 22.17% JavaScript 77.83%

angular-read-more's Introduction

hm-read-more

Build Status Coverage Status Dependency Status

AngularJS directive that limit text and adds read more / read less links to your text when it exeeds certain limit of characters. No requirements to JQuery. Angular animations are used for fade in/out.

Codepen demo

Codepen demo AngularJS Read More

Install client side

$ bower install angular-read-more --save-dev 

Note that angular-sanitize is required since this directive is allowing HTML tags to be used in text.

Run example locally

$ git clone
$ npm install
$ bower install
$ gulp watch

Test locally

$ git clone
$ npm install
$ bower install
$ gulp karma

How to use in HTML

Include JS script

<script src="//cdnjs.cloudflare.com/ajax/libs/angular-sanitize/1.6.4/angular-sanitize.min.js"></script>
<script src="/bower_components/angular-read-more/readmore.min.js"></script>

Add the module to your app,

angular.module("app", ["hm.readmore"]);

As element

<hm-read-more
		hm-text="{{ text }}" 
		hm-limit="100" 
		hm-more-text="read more" 
		hm-less-text="read less"
		hm-dots-class="dots"
        hm-link-class="links">
</hm-read-more>

As attribute

<div hm-read-more
		hm-text="{{ text }}" 
		hm-limit="100" 
		hm-more-text="read more" 
		hm-less-text="read less"
		hm-dots-class="dots"
        hm-link-class="links">
</div>
  • hm-text - full text
  • hm-limit - number > 0 of maximum characters before adding "..." and the more/less text. Default: unlimited
  • hm-more-text - link text for read more. Default: Read more
  • hm-less-text - link text for read less. Default: Read less
  • hm-dots-class - css class for dots
  • hm-link-class - css class for links of read more/read less text

License

angular-read-more is licensed under the MIT license.

Release new Github and Bower version

gulp bump
gulp build
git add .
git commit -m ""
git push

Use Github UI to create new tag and release

Register bower package for the first time

bower register angular-read-more git://github.com/ismarslomic/angular-read-more.git

angular-read-more's People

Contributors

ismarslomic avatar hiteshmodha avatar hjmodha avatar adam187 avatar gabzim avatar

Watchers

Prashant Shukla avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.