diff --git a/README.md b/README.md index 5d9f4ef..7f5778e 100644 --- a/README.md +++ b/README.md @@ -18,17 +18,14 @@ $ npm install --save ng2-fittext ### Usage -Import it in your Angular2 project like a directive +Import it in your Angular2 project like a module 1) Declare it in your module ```sh - import {FittextDirective} from "ng2-fittext/ng2-fittext"; + import {Ng2FittextModule} from "ng2-fittext/ng2-fittext"; @NgModule({ imports: [ - ... - ], - declarations: [ - FittextDirective + Ng2FittextModule ] }) @@ -41,7 +38,7 @@ Import it in your Angular2 project like a directive @Component({ selector: 'label', template: `
-
Bla bla bla...
+
Bla bla bla...
` }) @@ -55,7 +52,7 @@ Import it in your Angular2 project like a directive | --- | --- | --- | | fittext | is the selector of the directive | true/false | container | the container to fit | ElementRef - | onResize | enable/disable the autofit in case of window resize | true or false (default false) + | activateOnResize | enable/disable the autofit in case of window resize | true or false (default false) diff --git a/index.ts b/index.ts index 962feed..7107bfa 100644 --- a/index.ts +++ b/index.ts @@ -1 +1 @@ -export {FittextDirective} from './src/fittext.directive'; \ No newline at end of file +export {Ng2FittextModule} from './src/ng2fittext.module'; \ No newline at end of file diff --git a/ng2-fittext.ts b/ng2-fittext.ts deleted file mode 100644 index 962feed..0000000 --- a/ng2-fittext.ts +++ /dev/null @@ -1 +0,0 @@ -export {FittextDirective} from './src/fittext.directive'; \ No newline at end of file diff --git a/ng2fittext.ts b/ng2fittext.ts new file mode 100644 index 0000000..7107bfa --- /dev/null +++ b/ng2fittext.ts @@ -0,0 +1 @@ +export {Ng2FittextModule} from './src/ng2fittext.module'; \ No newline at end of file diff --git a/package.json b/package.json index 197401d..c85f22d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ng2-fittext", - "version": "1.0.3", + "version": "1.0.5", "description": "An Angular2 directive for autoscale the font size of an element to fit an upper level container.", "main": "index.js", "scripts": { diff --git a/src/fittext.directive.spec.ts b/src/ng2fittext.directive.spec.ts similarity index 100% rename from src/fittext.directive.spec.ts rename to src/ng2fittext.directive.spec.ts diff --git a/src/fittext.directive.ts b/src/ng2fittext.directive.ts similarity index 91% rename from src/fittext.directive.ts rename to src/ng2fittext.directive.ts index 561ab4a..b4076bd 100644 --- a/src/fittext.directive.ts +++ b/src/ng2fittext.directive.ts @@ -3,11 +3,11 @@ import {Directive, ElementRef, Renderer, Input, AfterViewInit, HostListener} fro @Directive({ selector: '[fittext]' }) -export class FittextDirective implements AfterViewInit { +export class Ng2FittextDirective implements AfterViewInit { @Input('fittext') fittext: any; @Input('container') container: any; - @Input('onResize') activateOnResize: boolean; + @Input('activateOnResize') activateOnResize: boolean; public fontSize:number = 0; public speed:number = 1.05; diff --git a/src/ng2fittext.module.ts b/src/ng2fittext.module.ts new file mode 100644 index 0000000..0313c74 --- /dev/null +++ b/src/ng2fittext.module.ts @@ -0,0 +1,11 @@ +import { NgModule } from '@angular/core'; +import { Ng2FittextDirective } from "./ng2fittext.directive"; + +@NgModule({ + declarations: [ + Ng2FittextDirective + ], + exports: [Ng2FittextDirective] +}) + +export class Ng2FittextModule {}; diff --git a/tsconfig.json b/tsconfig.json index bf91244..a088c86 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,8 +12,8 @@ "skipLibCheck": true }, "files": [ - "ng2-fittext.ts", - "ng2-fittext.d.ts", + "ng2fittext.ts", + "ng2fittext.d.ts", "index.ts" ] } \ No newline at end of file