Skip to content

Commit 2c28801

Browse files
committed
demo(app): integration of the latest features of the library
1 parent 0014c5b commit 2c28801

File tree

5 files changed

+90
-73
lines changed

5 files changed

+90
-73
lines changed

demo/src/app/app.module.ts

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,34 @@
1+
import {NgModule} from '@angular/core';
2+
import {HttpModule} from '@angular/http';
3+
import {FormsModule} from '@angular/forms';
4+
import {BrowserModule} from '@angular/platform-browser';
5+
import {TransferHttpCacheModule} from '@nguniversal/common';
16

2-
import { NgModule } from '@angular/core';
3-
import { HttpModule } from '@angular/http';
4-
import { FormsModule } from '@angular/forms';
5-
import { BrowserModule } from '@angular/platform-browser';
6-
import { TransferHttpCacheModule } from '@nguniversal/common';
7-
8-
import { AppRoutingModule } from './app-routing.module';
9-
import { AppSharedModule } from './shared/shared.module';
10-
import { HomeModule } from './home/home.module';
11-
import { AppComponent } from './app.component';
7+
import {AppRoutingModule} from './app-routing.module';
8+
import {AppSharedModule} from './shared/shared.module';
9+
import {HomeModule} from './home/home.module';
10+
import {AppComponent} from './app.component';
11+
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
1212

1313
@NgModule({
14-
declarations: [
15-
AppComponent
16-
],
17-
imports: [
18-
// Add .withServerTransition() to support Universal rendering.
19-
// The application ID can be any identifier which is unique on
20-
// the page.
21-
BrowserModule.withServerTransition({ appId: '@angular-material-extensions/link-preview-demo-id' }),
22-
TransferHttpCacheModule,
23-
FormsModule,
24-
HttpModule,
25-
AppRoutingModule,
26-
AppSharedModule,
27-
HomeModule
28-
],
29-
providers: [],
30-
bootstrap: [AppComponent]
14+
declarations: [
15+
AppComponent
16+
],
17+
imports: [
18+
// Add .withServerTransition() to support Universal rendering.
19+
// The application ID can be any identifier which is unique on
20+
// the page.
21+
BrowserModule.withServerTransition({appId: '@angular-material-extensions/link-preview-demo-id'}),
22+
TransferHttpCacheModule,
23+
BrowserAnimationsModule,
24+
FormsModule,
25+
HttpModule,
26+
AppRoutingModule,
27+
AppSharedModule,
28+
HomeModule
29+
],
30+
providers: [],
31+
bootstrap: [AppComponent]
3132
})
32-
export class AppModule { }
33+
export class AppModule {
34+
}

demo/src/app/home/home.component.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,15 @@ <h1>@angular-material-extensions/link-preview</h1>
2323
<div class="container">
2424
<!-- put your content here-->
2525
<p>Put your content here. Typically, examples of your library in action (directives, components...)</p>
26-
<mat-component></mat-component>
26+
<mat-form-field class="demo-full-width">
27+
<mat-label>Address 2</mat-label>
28+
<textarea matInput matLinkPreview></textarea>
29+
</mat-form-field>
30+
31+
<div>
32+
<mat-link-preview-container></mat-link-preview-container>
33+
</div>
34+
<!--<mat-component></mat-component>-->
2735
<p>Happy ng-hacking!</p>
2836
</div>
2937
</section>

demo/src/app/home/home.component.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { Component, OnInit } from '@angular/core';
2-
import { Title } from '@angular/platform-browser';
1+
import {Component, OnInit} from '@angular/core';
2+
import {Title} from '@angular/platform-browser';
3+
import {LinkPreviewService} from '@angular-material-extensions/link-preview';
34
import sdk from '@stackblitz/sdk';
45

56
@Component({
@@ -9,10 +10,13 @@ import sdk from '@stackblitz/sdk';
910
})
1011
export class HomeComponent implements OnInit {
1112

12-
constructor(private titleService:Title) { }
13+
constructor(private titleService: Title,
14+
public linkPreviewService: LinkPreviewService) {
15+
}
1316

1417
ngOnInit() {
1518
this.titleService.setTitle('Home | @angular-material-extensions/link-preview');
19+
// this.linkPreviewService.fetchLink('github.com').subscribe(res => console.log('response: ', res));
1620
}
1721

1822
editOnStackBlitz() {

demo/src/app/home/home.module.ts

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
import { NgModule } from '@angular/core';
2-
import { CommonModule } from '@angular/common';
3-
import { MatLinkPreviewModule } from '@angular-material-extensions/link-preview';
1+
import {NgModule} from '@angular/core';
2+
import {CommonModule} from '@angular/common';
3+
import {MatLinkPreviewModule} from '@angular-material-extensions/link-preview';
44

5-
import { HomeRoutingModule } from './home-routing.module';
6-
import { HomeComponent } from './home.component';
5+
import {HomeRoutingModule} from './home-routing.module';
6+
import {HomeComponent} from './home.component';
7+
import {MatInputModule} from '@angular/material';
78

89
@NgModule({
9-
imports: [
10-
CommonModule,
11-
MatLinkPreviewModule.forRoot(),
12-
HomeRoutingModule,
13-
],
14-
declarations: [HomeComponent],
10+
imports: [
11+
CommonModule,
12+
MatLinkPreviewModule.forRoot(),
13+
HomeRoutingModule,
14+
MatInputModule,
15+
],
16+
declarations: [HomeComponent],
1517
})
16-
export class HomeModule { }
18+
export class HomeModule {
19+
}

demo/src/styles.scss

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
/* You can add global styles to this file, and also import other style files */
2-
2+
@import "~@angular/material/prebuilt-themes/indigo-pink.css";
33
@import '_variables';
44
@import '~bootstrap/scss/bootstrap';
55
@import '~font-awesome/scss/font-awesome';
66

77
.jumbotron {
8-
//margin-top: 3.4rem;
9-
margin-bottom: 0rem;
10-
h1 {
11-
font-size: 2.5rem;
12-
margin-bottom: 1.4rem;
13-
}
14-
p {
15-
font-size: 1.2rem;
16-
}
8+
//margin-top: 3.4rem;
9+
margin-bottom: 0rem;
10+
h1 {
11+
font-size: 2.5rem;
12+
margin-bottom: 1.4rem;
13+
}
14+
p {
15+
font-size: 1.2rem;
16+
}
1717

18-
.btn{
19-
margin: .5rem;
20-
}
18+
.btn {
19+
margin: .5rem;
20+
}
2121

22-
.buttons a{
23-
margin: 0.2rem;
24-
}
22+
.buttons a {
23+
margin: 0.2rem;
24+
}
2525

2626
}
2727

2828
@include media-breakpoint-up(sm) {
29-
.jumbotron {
30-
// margin-top: 3.4rem;
31-
margin-bottom: 0rem;
32-
h1 {
33-
font-size: 3.6rem;
34-
margin-bottom: 1.8rem;
35-
}
36-
p {
37-
font-size: 1.4rem;
38-
}
39-
.buttons a{
40-
margin: 0.3rem;
41-
}
29+
.jumbotron {
30+
// margin-top: 3.4rem;
31+
margin-bottom: 0rem;
32+
h1 {
33+
font-size: 3.6rem;
34+
margin-bottom: 1.8rem;
35+
}
36+
p {
37+
font-size: 1.4rem;
38+
}
39+
.buttons a {
40+
margin: 0.3rem;
4241
}
42+
}
4343
}

0 commit comments

Comments
 (0)