Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

Commit

Permalink
feat(material-icon): Add [material-icon] directive
Browse files Browse the repository at this point in the history
Apply the "material-icons" style to an icon. *Note: must be using the material icons library
  • Loading branch information
trimox committed Jul 10, 2017
1 parent 5492bc9 commit 7ee67e5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ElevationModule } from './elevation/index';
import { FabModule } from './fab/index';
import { FormFieldModule } from './form-field/index';
import { LinearProgressModule } from './linear-progress/index';
import { MaterialIconModule } from './material-icon/index';
import { MenuModule } from './menu/index';
import { RadioModule } from './radio/index';
import { RippleModule } from './ripple/index';
Expand All @@ -24,6 +25,7 @@ export * from './elevation/index';
export * from './fab/index';
export * from './form-field/index';
export * from './linear-progress/index';
export * from './material-icon/index';
export * from './menu/index';
export * from './radio/index';
export * from './ripple/index';
Expand All @@ -42,6 +44,7 @@ const MATERIAL_MODULES = [
FabModule,
FormFieldModule,
LinearProgressModule,
MaterialIconModule,
MenuModule,
RadioModule,
RippleModule,
Expand All @@ -61,4 +64,4 @@ const MATERIAL_MODULES = [
MATERIAL_MODULES
]
})
export class MaterialModule { }
export class MaterialModule { }
9 changes: 9 additions & 0 deletions src/lib/material-icon/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { NgModule } from '@angular/core';

import { MaterialIcon } from './material-icon.directive';

@NgModule({
exports: [MaterialIcon],
declarations: [MaterialIcon],
})
export class MaterialIconModule { }
11 changes: 11 additions & 0 deletions src/lib/material-icon/material-icon.directive.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {
Directive,
HostBinding,
} from '@angular/core';

@Directive({
selector: '[material-icon]'
})
export class MaterialIcon {
@HostBinding('class.material-icons') isHostClass = true;
}

0 comments on commit 7ee67e5

Please sign in to comment.