11<p align =" center " >
2- <img height =" 256px " width =" 256px " style =" text-align : center ;" src =" https://cdn.rawgit.com/angular-material-extensions/link-preview/master/demo/src/assets/logo.svg " >
2+ <img alt="angular-material-extensions's logo"
3+ height="256px" width="256px" style="text-align: center;"
4+ src="https://cdn.rawgit.com/angular-material-extensions/link-preview/master/assets/angular-material-extensions-logo.svg">
35</p >
46
5- # link-preview - Angular open source UI library to preview web links
7+ # @ angular-material-extensions/ link-preview - Angular open source UI library to preview web links powered by ngx-linkifyjs and material design
68
79[ ![ npm version] ( https://badge.fury.io/js/%40angular-material-extensions%2Flink-preview.svg )] ( https://badge.fury.io/js/%40angular-material-extensions%2Flink-preview )
810[ ![ Join the chat at https://gitter.im/angular-material-extensions/Lobby ] ( https://badges.gitter.im/angular-material-extensions/Lobby.svg )] ( https://gitter.im/angular-material-extensions/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge )
1416[ ![ Greenkeeper Badge] ( https://badges.greenkeeper.io/angular-material-extensions/link-preview.svg )] ( https://greenkeeper.io/ )
1517[ ![ license] ( https://img.shields.io/github/license/angular-material-extensions/link-preview.svg?style=flat-square )] ( https://github.com/angular-material-extensions/link-preview/blob/master/LICENSE )
1618
17- ## Demo
19+ <p align =" center " >
20+ <img alt="ngx-linkifyjs demo" width="320px" style="text-align: center;"
21+ src="https://cdn.rawgit.com/angular-material-extensions/link-preview/master/assets/demo1.gif">
22+ </p >
23+
24+ multiple link preview
25+
26+ <p align =" center " >
27+ <img alt="ngx-linkifyjs demo" width="320px" style="text-align: center;"
28+ src="https://cdn.rawgit.com/angular-material-extensions/link-preview/master/assets/demo.png">
29+ </p >
30+
31+
32+ ## Built by and for developers :heart :
33+ Do you have any question or suggestion ? Please do not hesitate to contact us!
34+ Alternatively, provide a PR | open an appropriate issue [ here] ( https://github.com/angular-material-extensions/link-preview/issues )
35+
36+ If did you like this project, support [ angular-material-extensions] ( https://github.com/angular-material-extensions )
37+ by starring :star : and sharing it :loudspeaker :
38+
39+ ## Table of Contents
40+ - [ Demo] ( #demo )
41+ - [ Dependencies] ( #dependencies )
42+ - [ Peer Dependencies] ( #peerDependencies )
43+ - [ Additional Requirements - material (Include a theme)] ( #additional-requirements-material-theme )
44+ - [ Installation] ( #installation )
45+ - [ Usage] ( #usage )
46+ - [ Documentation] ( #documentation )
47+ - [ Run Demo App Locally] ( #run-demo-app-locally )
48+ - [ Development] ( #development )
49+ - [ Other Angular Libraries] ( #other-angular-libraries )
50+ - [ Support] ( #support )
51+ - [ License] ( #license )
1852
19- View all the directives in action at https://angular-material-extensions.github.io/link-preview
53+ <a name =" demo " />
54+
55+ ## [ Demo] ( https://angular-material-extensions.github.io/link-preview )
56+
57+ View all the directives and components in action at [ https://angular-material-extensions.github.io/link-preview ] ( https://angular-material-extensions.github.io/link-preview )
58+
59+ <a name =" dependencies " />
2060
2161## Dependencies
22- * [ Angular] ( https://angular.io ) (* requires* Angular 2 or higher, tested with 2.0.0)
62+ * [ Angular] ( https://angular.io ) (* requires* Angular 2 or higher, tested with V6)
63+
64+ <a name =" peerDependencies " />
65+
66+ ## Requirements (peer dependencies):
67+ - [ angular animations v6.1.0] ( https://www.npmjs.com/package/@angular/animations )
68+ - [ angular http v6.1.0] ( https://www.npmjs.com/package/@angular/http )
69+ - [ angular cdk v6.4.2] ( https://www.npmjs.com/package/@angular/cdk )
70+ - [ angular material v6.4.2] ( https://www.npmjs.com/package/@angular/material )
71+ - [ angular material theme] ( https://material.angular.io/guide/getting-started#step-4-include-a-theme )
72+
73+ ``` bash
74+ npm i @angular/cdk @angular/material @angular/animations @angular/forms
75+ ```
76+
77+ or use ` angular schematics ` like e.g:
78+
79+ ``` bash
80+ ng add @angular/material
81+ ```
82+
83+ ---
84+
85+ <a name =" additional-requirements-material-theme " />
86+
87+ ### Additional requirements Theme (Material Design)
88+ - [ angular material theme] ( https://material.angular.io/guide/getting-started#step-4-include-a-theme )
2389
2490## Installation
2591Install above dependencies via * npm* .
@@ -42,38 +108,181 @@ map: {
42108
43109Once installed you need to import the main module:
44110``` js
45- import { LibModule } from ' @angular-material-extensions/link-preview' ;
111+ import { MatLinkPreviewModule } from ' @angular-material-extensions/link-preview' ;
46112```
47113The only remaining part is to list the imported module in your application module. The exact method will be slightly
48- different for the root (top-level) module for which you should end up with the code similar to (notice ` LibModule .forRoot() ` ):
114+ different for the root (top-level) module for which you should end up with the code similar to (notice ` MatLinkPreviewModule .forRoot() ` ):
49115``` js
50- import { LibModule } from ' @angular-material-extensions/link-preview' ;
116+ import { MatLinkPreviewModule } from ' @angular-material-extensions/link-preview' ;
51117
52118@NgModule ({
53119 declarations: [AppComponent, ... ],
54- imports: [LibModule .forRoot (), ... ],
120+ imports: [MatLinkPreviewModule .forRoot (), ... ],
55121 bootstrap: [AppComponent]
56122})
57123export class AppModule {
58124}
59125```
60126
61- Other modules in your application can simply import ` LibModule ` :
127+ Other modules in your application can simply import ` MatLinkPreviewModule ` :
62128
63129``` js
64- import { LibModule } from ' @angular-material-extensions/link-preview' ;
130+ import { MatLinkPreviewModule } from ' @angular-material-extensions/link-preview' ;
65131
66132@NgModule ({
67133 declarations: [OtherComponent, ... ],
68- imports: [LibModule , ... ],
134+ imports: [MatLinkPreviewModule , ... ],
69135})
70136export class OtherModule {
71137}
72138```
73139
74140## Usage
75141
142+ ### Directives
143+
144+ #### ` matLinkPreview ` used to find and parse links from any text input - should be used in combination with ` <mat-link-preview-container> ` to render and preview the found links
145+
146+ e.g:
147+
148+ ``` html
149+ <mat-form-field class =" demo-full-width" appearance =" outline" >
150+ <mat-label >Enter here your text here with few links to preview ;)</mat-label >
151+ <textarea matInput matTextareaAutosize matLinkPreview minRows =" 6" ></textarea >
152+ </mat-form-field >
153+ ```
154+
155+ ### Components
156+
157+ #### ` <mat-link-preview-container> ` the container that hold the links to preview
158+
159+ | option | bind | type | default | description |
160+ | :-------------------| :--------:| :------:| :------------:| :-------------------------------------------------------------------------------------------------|
161+ | color | ` Input() ` | ` string ` | ` primary ` | the color to use for the <a > button of the url - options --> ` primary | accent | warn `
162+ | multiple | ` Input() ` | ` boolean ` | ` false ` | whether to find, parse and render one single or multiple links
163+ | showLoadingsProgress| ` Input() ` | ` boolean ` | ` true ` | whether to show and render a loading spinner while fetching the link to preview
164+
165+ e.g:
166+
167+ ``` html
168+ <mat-link-preview-container color =" primary" [multiple] =" true" ></mat-link-preview-container >
169+ ```
170+
171+ #### Full example code
172+
173+ ``` html
174+ <div class =" container" fxFlex.xs =" 100" fxFlex.sm =" 70" fxFlex =" 50" >
175+ <div fxLayout =" column" fxLayoutAlign =" center" >
176+
177+ <!-- here -->
178+ <mat-form-field class =" demo-full-width" appearance =" outline" >
179+ <mat-label >Enter here your text here with few links to preview ;)</mat-label >
180+ <textarea matInput matTextareaAutosize matLinkPreview minRows =" 6" ></textarea >
181+ <mat-link-preview-container [multiple] =" true" ></mat-link-preview-container >
182+ </mat-form-field >
183+ <!-- #### -->
184+
185+ </div >
186+ </div >
187+ ```
188+
189+ ---
190+
191+ <a name =" documentation " />
192+
193+ ## [ Documentation] ( https://angular-material-extensions.github.io/link-preview/doc/index.html )
194+
195+ Please checkout the full documentation [ here] ( https://angular-material-extensions.github.io/link-preview/doc/index.html )
196+
197+
198+ <a name =" run-demo-app-locally " />
199+
200+ ## Run Demo App Locally
201+
202+ - [ clone this repo] ( https://github.com/angular-material-extensions/link-preview.git ) by running
203+ ``` bash
204+ $ git clone https://github.com/angular-material-extensions/link-preview.git
205+ ```
206+
207+ - link the ** @angular-material-extensions/link-preview ** package
208+
209+ ``` bash
210+ $ gulp link
211+ ```
212+
213+ - navigate to the demo app directory
214+ ``` bash
215+ $ cd demo
216+ ```
217+
218+ - install the dependencies
219+ ``` bash
220+ $ npm i
221+ ```
222+
223+ - run/start/serve the app
224+ ``` bash
225+ $ npm run start
226+ ```
227+ or
228+ ``` bash
229+ $ ng serve --open
230+ ```
231+ - the app is now hosted by ` http://localhost:4200/ `
232+
233+
234+ <a name =" development " />
235+
236+ ## Development
237+
238+ 1 . clone this [ repo] ( https://github.com/angular-material-extensions/link-preview.git )
239+ 2 . Install the dependencies by running ` npm i `
240+ 3 . build the library ` npm run build ` or ` gulp build `
241+ To generate all ` *.js ` , ` *.d.ts ` and ` *.metadata.json ` files:
242+
243+ ``` bash
244+ $ npm run build
245+ ```
246+
247+ 4 . Link the library
248+ - on windows ` gulp link ` or locally ` npx gulp link `
249+ - on mac/linux ` sudo gulp link ` or locally ` sudo npx gulp link `
250+
251+ 5 . Navigate to the demo app's directory
252+ - ` cd demo `
253+ _ ` npm i `
254+ _ ` npm start `
255+
256+
257+
258+ <a name =" other-angular-libraries " />
259+
260+ ## Other Angular Libraries
261+ - [ ngx-auth-firebaseui] ( https://github.com/AnthonyNahas/ngx-auth-firebaseui )
262+ - [ ngx-linkifyjs] ( https://github.com/AnthonyNahas/ngx-linkifyjs )
263+ - [ @angular-material-extensions/password-strength ] ( https://github.com/angular-material-extensions/password-strength )
264+ - [ @angular-material-extensions/google-maps-autocomplete ] ( https://github.com/angular-material-extensions/google-maps-autocomplete )
265+ - [ @angular-material-extensions/pages ] ( https://github.com/angular-material-extensions/pages )
266+ - [ @angular-material-extensions/contacts ] ( https://github.com/angular-material-extensions/contacts )
267+ - [ @angular-material-extensions/faq ] ( https://github.com/angular-material-extensions/faq )
268+ - [ @angular-material-extensions/cards ] ( https://github.com/angular-material-extensions/cards )
269+ - [ @angular-material-extensions/combination-generator ] ( https://github.com/angular-material-extensions/combination-generator )
270+
271+ ---
272+
273+
274+ <a name =" support " />
275+
276+ ## Support
277+ + Drop an email to:
[ Anthony Nahas
] ( mailto:[email protected] ) 278+ + or open an appropriate [ issue] ( https://github.com/angular-material-extensions/link-preview/issues )
279+ + let us chat on [ Gitter] ( https://gitter.im/angular-material-extensions/Lobby )
280+
281+ Built by and for developers :heart : we will help you :punch :
282+
283+ ---
76284
285+ <a name =" license " />
77286
78287## License
79288
0 commit comments