Skip to content

Commit

Permalink
fix(demo): updated the first example in the home component
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyNahas committed Apr 21, 2019
1 parent 6e48f2f commit 912db7d
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 117 deletions.
118 changes: 59 additions & 59 deletions demo/src/app/home/home.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,73 +25,72 @@ <h1>@angular-material-extensions/password-strength</h1>
<section class="home">
<div class="container">

<!-- <div fxLayout="column">-->
<!-- <mat-toolbar>-->
<!-- @angular-material-extensions/password-strength-->
<!-- <span fxFlex></span>-->
<div fxLayout="column">
<mat-toolbar>
@angular-material-extensions/password-strength
<span fxFlex></span>

<!-- <button mat-icon-button-->
<!-- color="accent"-->
<!-- matTooltip="view source"-->
<!-- (click)="viewSource2 = !viewSource2">-->
<!-- <mat-icon>code</mat-icon>-->
<!-- </button>-->
<!-- </mat-toolbar>-->
<!-- <mat-card>-->
<!-- <mat-card-subtitle>-->
<!-- stand alone password component-->
<!-- </mat-card-subtitle>-->
<button mat-icon-button
color="accent"
matTooltip="view source"
(click)="viewSource2 = !viewSource2">
<mat-icon>code</mat-icon>
</button>
</mat-toolbar>
<mat-card>
<mat-card-subtitle>
stand alone password component
</mat-card-subtitle>


<!-- <mat-card-content *ngIf="viewSource2">-->
<!-- <mat-tab-group>-->
<!-- &lt;!&ndash;tab 1&ndash;&gt;-->
<!-- <mat-tab>-->
<!-- <ng-template mat-tab-label>HTML</ng-template>-->
<!-- <pre><code highlight [highlight]="html1"></code></pre>-->
<!-- </mat-tab>-->
<mat-card-content *ngIf="viewSource2">
<mat-tab-group>
<!--tab 1-->
<mat-tab>
<ng-template mat-tab-label>HTML</ng-template>
<markdown src="assets/md/home/e1/html.md"></markdown>
</mat-tab>

<!-- <mat-tab>-->
<!-- <ng-template mat-tab-label>TS</ng-template>-->
<!-- <pre><code highlight [highlight]="ts"></code></pre>-->
<!-- </mat-tab>-->
<!-- </mat-tab-group>-->
<!-- </mat-card-content>-->
<mat-tab>
<ng-template mat-tab-label>TS</ng-template>
<markdown src="assets/md/home/e1/ts.md"></markdown>
</mat-tab>
</mat-tab-group>
</mat-card-content>

<!-- <mat-card-subtitle>-->
<!-- <mat-slide-toggle [(ngModel)]="showDetails">Show Password Details</mat-slide-toggle>-->
<!-- </mat-card-subtitle>-->
<mat-card-subtitle>
<mat-slide-toggle [(ngModel)]="showDetails">Show Password Details</mat-slide-toggle>
</mat-card-subtitle>

<!-- <mat-card-content>-->
<!-- &lt;!&ndash;password input filed&ndash;&gt;-->
<!-- <mat-form-field appearance="outline" style="width: 100%" [color]="passwordComponent.color">-->
<!-- <mat-label>Password</mat-label>-->
<!-- <mat-pass-toggle-visibility #toggle matSuffix></mat-pass-toggle-visibility>-->
<!-- <input matInput #password-->
<!-- [type]="toggle.type"-->
<!-- required-->
<!-- placeholder="Password">-->
<!-- <mat-hint align="end" aria-live="polite">-->
<!-- {{password.value.length}} / 25-->
<!-- </mat-hint>-->
<!-- </mat-form-field>-->
<mat-card-content>
<!--password input filed-->
<mat-form-field appearance="outline" style="width: 100%" [color]="passwordComponent.color">
<mat-label>Password</mat-label>
<mat-pass-toggle-visibility #toggle matSuffix></mat-pass-toggle-visibility>
<input matInput #password
[type]="toggle.type"
required
placeholder="Password">
<mat-hint align="end" aria-live="polite">
{{password.value.length}} / {{passwordComponent.max}}
</mat-hint>
</mat-form-field>

<!-- &lt;!&ndash;@angular-material-extensions/password-strength's main component&ndash;&gt;-->
<!-- <mat-password-strength #passwordComponent-->
<!-- [enableDigitRule]="true"-->
<!-- (onStrengthChanged)="onStrengthChanged($event)"-->
<!-- [password]="password.value">-->
<!-- </mat-password-strength>-->
<!--@angular-material-extensions/password-strength's main component-->
<mat-password-strength #passwordComponent
(onStrengthChanged)="onStrengthChanged($event)"
[password]="password.value">
</mat-password-strength>

<!-- &lt;!&ndash;Password's strength info&ndash;&gt;-->
<!-- <mat-password-strength-info-->
<!-- *ngIf="showDetails"-->
<!-- [passwordComponent]="passwordComponent">-->
<!-- </mat-password-strength-info>-->
<!--Password's strength info-->
<mat-password-strength-info
*ngIf="showDetails"
[passwordComponent]="passwordComponent">
</mat-password-strength-info>

<!-- </mat-card-content>-->
<!-- </mat-card>-->
<!-- </div>-->
</mat-card-content>
</mat-card>
</div>
<!--NGX-MATERIAL-PASSWORD-STRENGTH WITH VALIDATION AND FORM CONTROLLER-->

<!-- <div fxLayout="column" class="mt-3">-->
Expand Down Expand Up @@ -276,7 +275,8 @@ <h1>@angular-material-extensions/password-strength</h1>
<mat-error *ngIf="passwordComponentWithValidation2.passwordConfirmationFormControl.hasError('required')">
Password confirmation is required
</mat-error>
<mat-error *ngIf="passwordComponentWithValidation2.passwordConfirmationFormControl.hasError('notConfirmed')">
<mat-error
*ngIf="passwordComponentWithValidation2.passwordConfirmationFormControl.hasError('notConfirmed')">
Password is not the same
</mat-error>

Expand Down
67 changes: 24 additions & 43 deletions demo/src/assets/md/home/e1/html.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,26 @@
```html
<mat-card fxFlex>
<mat-card-title>
@angular-material-extensions/password-strength
</mat-card-title>
<mat-card-subtitle>
stand alone password component
</mat-card-subtitle>

<mat-card-subtitle>
<mat-slide-toggle [(ngModel)]="showDetails">Show Password Details</mat-slide-toggle>
</mat-card-subtitle>

<mat-card-content>
<div fxFlex>

<!--password input filed-->
<mat-form-field appearance="outline" style="width: 100%" [color]="passwordComponent.color">
<mat-label>Password</mat-label>
<mat-pass-toggle-visibility #toggle matSuffix></mat-pass-toggle-visibility>
<input matInput #password
[type]="toggle.type"
required
placeholder="Password">
<mat-hint align="end" aria-live="polite">
{{password.value.length}} / 25
</mat-hint>
</mat-form-field>

<!--@angular-material-extensions/password-strength's main component-->
<mat-password-strength #passwordComponent
(onStrengthChanged)="onStrengthChanged($event)"
[password]="password.value">
</mat-password-strength>

<!--Password's strength info-->
<mat-password-strength-info
*ngIf="showDetails"
[passwordComponent]="passwordComponent">
</mat-password-strength-info>

</div>
</mat-card-content>
</mat-card>
<div fxFlex>
<!--password input filed-->
<mat-form-field appearance="outline" style="width: 100%" [color]="passwordComponent.color">
<mat-label>Password</mat-label>
<mat-pass-toggle-visibility #toggle matSuffix></mat-pass-toggle-visibility>
<input matInput #password
[type]="toggle.type"
required
placeholder="Password">
<mat-hint align="end" aria-live="polite">
{{password.value.length}} / {{passwordComponent.max}}
</mat-hint>
</mat-form-field>
<!--@angular-material-extensions/password-strength's main component-->
<mat-password-strength #passwordComponent
(onStrengthChanged)="onStrengthChanged($event)"
[password]="password.value">
</mat-password-strength>
<!--Password's strength info-->
<mat-password-strength-info
*ngIf="showDetails"
[passwordComponent]="passwordComponent">
</mat-password-strength-info>
</div>
```
16 changes: 1 addition & 15 deletions demo/src/assets/md/home/e1/ts.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
```typescript
import {Component, OnInit, ViewEncapsulation} from '@angular/core';
import {Title} from '@angular/platform-browser';
import {MatSlideToggleChange} from '@angular/material';
import {Component, OnInit} from '@angular/core';

@Component({
selector: 'app-home',
Expand All @@ -10,19 +8,7 @@ import {MatSlideToggleChange} from '@angular/material';
})
export class HomeComponent implements OnInit {

password: string;
showDetails: boolean;
showDetails2: boolean;

viewSource: boolean;
viewSource2: boolean;
color = '';

constructor(private titleService: Title) {
}

ngOnInit() {
this.titleService.setTitle('Home | @angular-material-extensions/password-strength');
}

onStrengthChanged(strength: number) {
Expand Down
26 changes: 26 additions & 0 deletions demo/src/assets/md/home/e2/html.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
```html
<div fxFlex>
<!--password input filed-->
<mat-form-field appearance="outline" style="width: 100%" [color]="passwordComponent.color">
<mat-label>Password</mat-label>
<mat-pass-toggle-visibility #toggle matSuffix></mat-pass-toggle-visibility>
<input matInput #password
[type]="toggle.type"
required
placeholder="Password">
<mat-hint align="end" aria-live="polite">
{{password.value.length}} / 25
</mat-hint>
</mat-form-field>
<!--@angular-material-extensions/password-strength's main component-->
<mat-password-strength #passwordComponent
(onStrengthChanged)="onStrengthChanged($event)"
[password]="password.value">
</mat-password-strength>
<!--Password's strength info-->
<mat-password-strength-info
*ngIf="showDetails"
[passwordComponent]="passwordComponent">
</mat-password-strength-info>
</div>
```
18 changes: 18 additions & 0 deletions demo/src/assets/md/home/e2/ts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
```typescript
import {Component, OnInit} from '@angular/core';

@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {

ngOnInit() {
}

onStrengthChanged(strength: number) {
console.log('password strength = ', strength);
}
}
```

0 comments on commit 912db7d

Please sign in to comment.