Skip to content

Commit

Permalink
fix: using ngAcceptInputType_ for count input
Browse files Browse the repository at this point in the history
  • Loading branch information
willmendesneto committed Feb 18, 2021
1 parent a75ad6c commit 84ea441
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ export class NgxSkeletonLoaderComponent implements OnInit, AfterViewInit, OnDest

items: Array<any> = [];

static ngAcceptInputType_count: number | string;

ngOnInit() {
start('NgxSkeletonLoader:Rendered');
start('NgxSkeletonLoader:Loaded');

this.items.length = this.count;
this.items.length = +this.count;
const allowedAnimations = ['progress', 'progress-dark', 'pulse', 'false'];
if (allowedAnimations.indexOf(String(this.animation)) === -1) {
// Shows error message only in Development
Expand Down
8 changes: 6 additions & 2 deletions projects/ngx-skeleton-loader/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@
"declaration": true,
"inlineSources": true,
"types": [],
"lib": ["dom", "es2018"]
"lib": ["dom", "es2018"],
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
},
"angularCompilerOptions": {
"annotateForClosureCompiler": true,
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true,
"enableResourceInlining": true
"enableResourceInlining": true,
"strictTemplates": true
},
"exclude": ["src/test.ts", "**/*.spec.ts"]
}
2 changes: 1 addition & 1 deletion src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ <h3>Skeleton using `progress-dark` animation</h3>

<div class="item-with-background">
<ngx-skeleton-loader
count="2"
[count]="count"
[animation]="animation"
[theme]="{
'border-radius': '5px',
Expand Down
7 changes: 5 additions & 2 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,18 @@ export class AppComponent implements OnInit, OnDestroy {

animation = 'pulse';
contentLoaded = false;
intervalId;
count = 2;

intervalId: number | null = null;

ngOnInit() {
setTimeout(() => {
this.contentLoaded = true;
}, 2000);

this.intervalId = setInterval(() => {
this.intervalId = window.setInterval(() => {
this.animation = this.animation === 'pulse' ? 'progress-dark' : 'pulse';
this.count = this.count === 2 ? 5 : 2;
}, 5000);
}

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
"types": ["node"]
},
"include": ["src/**/*.ts"],
"files": ["src/main.ts", "src/polyfills.ts"],
Expand Down
11 changes: 10 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@
"paths": {
"ngx-skeleton-loader": ["dist/ngx-skeleton-loader"],
"ngx-skeleton-loader/*": ["dist/ngx-skeleton-loader/*"]
}
},
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}
3 changes: 2 additions & 1 deletion tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
"template-banana-in-box": true,
"template-no-negated-async": true,
"use-lifecycle-interface": true,
"use-pipe-transform-interface": true
"use-pipe-transform-interface": true,
"no-any": true
},
"rulesDirectory": ["codelyzer"]
}

0 comments on commit 84ea441

Please sign in to comment.