GithubHelp home page GithubHelp logo

pkdevbox / read-more-directive Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andoulla/read-more-directive

0.0 1.0 0.0 216 KB

An AngularJs directive that creates a read-more compoment that allows to partially display the content of models and on click expand/collaps

HTML 28.54% JavaScript 71.46%

read-more-directive's Introduction

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

Attribute Description Required Example
ngModel An angular model containing the text you would like to display Yes $scope.content
length The desired length of the text you would like to display when it is collapsed Yes 50
words Whether you would like to display n words or characters No - 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

read-more-directive's People

Watchers

 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.