0.0.0 • Published 9 years ago

read-more v0.0.0

Weekly downloads
34
License
MIT
Repository
github
Last release
9 years ago

Read-More-Directive

An AngularJs directive that creates a read-more ui component that allows to partially display the content of model and on click expands or collapses it

Getting started:

Simple add the readmore.js file to your project,

<script src="path/to/file/readmore.js"></script>

add the module to your app,

angular.module("myApp", ["readMore"]);

add the directive on the tag you want to convert as a read-more field

<p read-more ng-model="content" words="true" length="50"></p>

or

<li read-more ng-model="content" words="false" length="50"></li>

Description of attributes

AttributeDescriptionRequiredExample
ngModelAn angular model containing the text you would like to displayYes$scope.content
lengthThe desired length of the text you would like to display when it is collapsedYes50
wordsWhether you would like to display n words or charactersNo - defaults to true"true"

What it does

  • This directive truncates the given text according to the specified length (n)
  • If words = true then the directive will display n number of words
  • If words = false then the directive will display n number of characters
  • If words flag is omitted then default behaviour is that words == true