Skip to content

Commit 2765f21

Browse files
committed
put button HTML into file
1 parent 39de594 commit 2765f21

File tree

5 files changed

+13
-20
lines changed

5 files changed

+13
-20
lines changed

src/material-experimental/mdc-button/button-base.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,6 @@ import {
2222
RippleTarget
2323
} from '@angular/material/core';
2424

25-
/** Shared template to be used by the standard button, FAB, and icon button. */
26-
export const MAT_BUTTON_TEMPLATE = `
27-
<ng-content select=".material-icons:not([iconPositionEnd]), mat-icon:not([iconPositionEnd])">
28-
</ng-content>
29-
30-
<span class="mdc-button__label"><ng-content></ng-content></span>
31-
32-
<ng-content select=".material-icons[iconPositionEnd], mat-icon[iconPositionEnd]">
33-
</ng-content>
34-
`;
35-
3625
/** Inputs common to all buttons. */
3726
export const MAT_BUTTON_INPUTS = ['disabled', 'disableRipple', 'color'];
3827

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<ng-content select=".material-icons:not([iconPositionEnd]), mat-icon:not([iconPositionEnd])">
2+
</ng-content>
3+
4+
<span class="mdc-button__label"><ng-content></ng-content></span>
5+
6+
<ng-content select=".material-icons[iconPositionEnd], mat-icon[iconPositionEnd]">
7+
</ng-content>

src/material-experimental/mdc-button/button.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {
2323
MAT_ANCHOR_INPUTS,
2424
MAT_BUTTON_HOST,
2525
MAT_BUTTON_INPUTS,
26-
MAT_BUTTON_TEMPLATE,
2726
MatAnchorBase,
2827
MatButtonBase
2928
} from './button-base';
@@ -35,7 +34,7 @@ import {
3534
button[mat-button], button[mat-raised-button], button[mat-flat-button],
3635
button[mat-stroked-button]
3736
`,
38-
template: MAT_BUTTON_TEMPLATE,
37+
templateUrl: 'button.html',
3938
styleUrls: ['button.css'],
4039
inputs: MAT_BUTTON_INPUTS,
4140
host: MAT_BUTTON_HOST,
@@ -57,7 +56,7 @@ export class MatButton extends MatButtonBase {
5756
exportAs: 'matButton, matAnchor',
5857
host: MAT_ANCHOR_HOST,
5958
inputs: MAT_ANCHOR_INPUTS,
60-
template: MAT_BUTTON_TEMPLATE,
59+
templateUrl: 'button.html',
6160
styleUrls: ['button.css'],
6261
encapsulation: ViewEncapsulation.None,
6362
changeDetection: ChangeDetectionStrategy.OnPush,

src/material-experimental/mdc-button/fab.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,14 @@ import {
2424
MAT_ANCHOR_INPUTS,
2525
MAT_BUTTON_HOST,
2626
MAT_BUTTON_INPUTS,
27-
MAT_BUTTON_TEMPLATE,
2827
MatButtonBase
2928
} from './button-base';
3029

3130

3231
@Component({
3332
moduleId: module.id,
3433
selector: `button[mat-fab], button[mat-mini-fab]`,
35-
template: MAT_BUTTON_TEMPLATE,
34+
templateUrl: 'button.html',
3635
styleUrls: ['fab.css'],
3736
inputs: MAT_BUTTON_INPUTS,
3837
host: MAT_BUTTON_HOST,
@@ -51,7 +50,7 @@ export class MatFabButton extends MatButtonBase {
5150
@Component({
5251
moduleId: module.id,
5352
selector: `a[mat-fab], a[mat-mini-fab]`,
54-
template: MAT_BUTTON_TEMPLATE,
53+
templateUrl: 'button.html',
5554
styleUrls: ['fab.css'],
5655
inputs: MAT_ANCHOR_INPUTS,
5756
host: MAT_ANCHOR_HOST,

src/material-experimental/mdc-button/icon-button.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {
2323
MAT_ANCHOR_INPUTS,
2424
MAT_BUTTON_HOST,
2525
MAT_BUTTON_INPUTS,
26-
MAT_BUTTON_TEMPLATE,
2726
MatAnchorBase,
2827
MatButtonBase
2928
} from './button-base';
@@ -32,7 +31,7 @@ import {
3231
@Component({
3332
moduleId: module.id,
3433
selector: `button[mat-icon-button]`,
35-
template: MAT_BUTTON_TEMPLATE,
34+
templateUrl: 'button.html',
3635
styleUrls: ['icon-button.css'],
3736
inputs: MAT_BUTTON_INPUTS,
3837
host: MAT_BUTTON_HOST,
@@ -53,7 +52,7 @@ export class MatIconButton extends MatButtonBase {
5352
@Component({
5453
moduleId: module.id,
5554
selector: `a[mat-icon-button]`,
56-
template: MAT_BUTTON_TEMPLATE,
55+
templateUrl: 'button.html',
5756
styleUrls: ['icon-button.css'],
5857
inputs: MAT_ANCHOR_INPUTS,
5958
host: MAT_ANCHOR_HOST,

0 commit comments

Comments
 (0)