# angular-truncate-2

> Angular Truncate 2 - Ellipsis for your templates

Latest version **0.4.2** (published 2015-12-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install angular-truncate-2
pnpm add angular-truncate-2
yarn add angular-truncate-2
bun add angular-truncate-2
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.2 |
| Published | 2015-12-16 |
| First published | 2015-05-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.8 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 14 |
| Author | Bernardo Silva |
| Maintainers | bernardosilva |

## Links

- npm: https://www.npmjs.com/package/angular-truncate-2
- Repository: https://github.com/BernardoSilva/angular-truncate-2
- Issues: https://github.com/BernardoSilva/angular-truncate-2/issues
- npm.io page: https://npm.io/package/angular-truncate-2

## Recent versions

- 0.4.2 (latest) — 2015-12-16
- 0.4.1 — 2015-11-01
- 0.4.0 — 2015-10-31
- 0.3.1 — 2015-10-31
- 0.3.0 — 2015-10-31
- 0.1.2 — 2015-05-07

## README

Angular Truncate
----------------

[![License](https://img.shields.io/npm/l/angular-truncate-2.svg)](http://bower.io/search/?q=angular-truncate-2)
[![Build Status](https://travis-ci.org/BernardoSilva/angular-truncate-2.svg?branch=master)](https://travis-ci.org/BernardoSilva/angular-truncate-2)
[![Coverage Status](https://coveralls.io/repos/BernardoSilva/angular-truncate-2/badge.svg)](https://coveralls.io/r/BernardoSilva/angular-truncate-2)
[![Bower](https://img.shields.io/bower/v/angular-truncate-2.svg)](http://bower.io/search/?q=angular-truncate-2)
[![NPM](https://img.shields.io/npm/v/angular-truncate-2.svg)](https://www.npmjs.com/package/angular-truncate-2)


This project is a filter for Angularjs to truncate text strings to a set number of characters or words and
add ellipses when needed.

[Demo](http://bernardosilva.github.io/angular-truncate-2/)

## Install

You can install this package with `bower`, `npm` and `gem`.

### bower

[View in Bower](http://bower.io/search/?q=angular-truncate-2)

```shell
bower install angular-truncate-2
```

The files are then available at `bower_components/angular-truncate-2/src/angular-truncate-2.js`

### npm

[View in NPM](https://www.npmjs.com/package/angular-truncate-2)

```shell
npm install angular-truncate-2
```

The files are then available at `node_modules/angular-truncate-2/src/angular-truncate-2.js`


### gem

Converted using [rails-asset](https://rails-assets.org/).

```shell
gem 'rails-assets-angular-truncate-2'
```
Include following in application.js:
```js
//= require angular-truncate-2
```

## How to use angular truncate


###Include the javascript file.

``` html
<script src="angular-truncate-2.min.js"></script>
```

###Inject the `truncate` filter into your app module.

```javascript
var myApp = angular.module('myApp', ['truncate']);
```

###When outputting text, apply the filter.
```html
 <p>
    {{ text | characters:25 }} or {{ text | words:5 }}
</p>
```

By default, a _word_ will not be truncated. Set the optional boolean after the character count to true.
```html
 <p>
     {{ text | characters:25 :true}}
 </p>
 ```

Filters can also be chained together. It will truncate after 25 words or before 25 words if the 100 character limit is reached.
 ```html
  <p>
     {{ text | words:25 | characters: 100}}
 </p>
 ```

## How contribute

* Fork the repository
* Do your changes/suggestions
* Create a Pull Request


### How to run tests

```sh
npm test
```


This project is based on [angular-truncate](https://github.com/sparkalow/angular-truncate) created by Brian Mathews.

---
_Source: https://npm.io/package/angular-truncate-2 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
