ng-trunk8
v0.2.2
Published
angular fork of trunk8
Downloads
12
Readme
ng-trunk8
About
ng-trunk8 is angular directive for trunk8.
Install
[npm|bower] install ng-trunk8 -S
Usage
angular.modaule('app', ['ng-trunk8'])
Default
<div trunk8>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor.</div>
By default, trunk8 will add an ellipsis (…
) after the truncated text.
Custom Settings
<div trunk8="{fill:'[sninp]', side:'center', text: vm.text}"></div> //
Settings
- fill (Default: '
…
') The string to insert in place of the omitted text. This value may include HTML. - lines (Default:
1
) The number of lines of text-wrap to tolerate before truncating. This value must be an integer greater than or equal to 1. - side (Default:
'right'
) The side of the text from which to truncate. Valid values include'center'
,'left'
, and'right'
. - tooltip (Default:
true
) When true, thetitle
attribute of the targeted HTML element will be set to the original, untruncated string. Valid values includetrue
andfalse
. - width (Default:
'auto'
) The width, in characters, of the desired text. When set to'auto'
, trunk8 will maximize the amount of text without spilling over. - parseHTML (Default:
'false'
) When true, parse and save html structure and restore structure in the truncated text. - onTruncate (Callback): Called after truncation is completed.
- text : text will be truncated. if not gave, element.html() will be truncated.
- expendable (Default: false) When true, add expend link and collapse link at the end. you can customuze the two links by setting
more
andless
config item. - resizeable (Default: true) When true, will retruncate text to fill current window size.
- more (Default: 'more') text for expend link.
- less (Default: 'less') text for collapes link.
MIT License
Copyright (c) 2016 Fuxian Ding ([email protected])
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.