UNPKG

2.41 kBMarkdownView Raw
1ngx-wig
2=====
3
4[![Build Status](https://travis-ci.org/stevermeister/ngx-wig.svg?branch=master)](https://travis-ci.org/stevermeister/ngx-wig)
5
6![screen shot 2017-12-12 at 14 52 51](https://user-images.githubusercontent.com/1526680/33888069-37bde1f0-df4c-11e7-993e-d48ffe0fffbf.png)
7
8
9## Dependencies
10
11*it's only Angular! No jQuery or other WYSIWYG monsters*
12
13
14## Installation
15
16ngx-wig could be simply installed via npm:
17
18 npm install ngx-wig --save
19
20### Important note:
21
22The last version on ngx-wig that was built for Angular 4.x is 0.3.6.
23Any higher version may be not fully compatible with Angular version lower than 5.0.0.
24
25
26## Usage
27
28First, import the ngx-wig to your module:
29
30```typescript
31import {NgxWigModule} from 'ngx-wig';
32
33@NgModule({
34 imports: [ NgxWigModule ]
35});
36```
37
38it's just attribute directive for textarea:
39
40```html
41<ngx-wig [content]="text1"></ngx-wig>
42```
43
44## Examples
45
46### Quick start ( [demo](https://stackblitz.com/edit/angular-2uzcl1?file=app/app.component.html) )
47
48```html
49<ngx-wig [content]="text1"></ngx-wig>
50```
51
52### Placeholder ( [demo](https://stackblitz.com/edit/angular-hzfneh?file=app/app.component.html) )
53
54```html
55<ngx-wig [content]="text1" [placeholder]="'Enter instructions here.'"></ngx-wig>
56```
57
58### ngModel sync ( [demo](https://stackblitz.com/edit/ngx-wig-2-way-binding-choit3?file=app%2Fapp.component.html) )
59
60```html
61<ngx-wig [ngModel]="text1"></ngx-wig>
62<ngx-wig [ngModel]="text1"></ngx-wig>
63```
64
65### Set buttons ( [demo](https://stackblitz.com/edit/angular-y5b6bz?file=app/app.component.html) )
66
67```html
68<ngx-wig [content]="text1" [buttons]="bold, italic"></ngx-wig>
69```
70
71### onContentChange Hook ( [demo](https://stackblitz.com/edit/angular-adxhiw?file=app/app.component.ts) )
72
73```html
74<ngx-wig [content]="text1" (contentChange)="result = $event"></ngx-wig>
75<div [innerHTML]="result"></div>
76```
77
78### Reactive FormControl ( [demo](https://stackblitz.com/edit/angular-srbxem?file=app/app.component.html) )
79
80```html
81<ngx-wig [content]="name" [buttons]="'bold, italic'"></ngx-wig>
82```
83
84### Two-way binding ( [demo](https://stackblitz.com/edit/ngx-wig-2-way-binding) )
85
86```html
87<ngx-wig [(ngModel)]="name"></ngx-wig>
88```
89
90
91
92## Development
93
94To generate all `*.js`, `*.d.ts` and `*.metadata.json` files:
95
96```bash
97$ npm run build
98```
99
100To lint all `*.ts` files:
101
102```bash
103$ npm run lint
104```
105
106## License
107
108MIT © [Stepan Suvorov](https://github.com/stevermeister)