Skip to content

Commit 9f3e890

Browse files
fix(components/layout): allow strict templates to use backToTop directive without square brackets (#737)
1 parent 0b717db commit 9f3e890

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

apps/code-examples/src/app/app.component.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,18 @@
218218
<li>
219219
Layout
220220
<ul>
221+
<li>
222+
Back to top
223+
<ul>
224+
<li><a routerLink="layout/back-to-top/grid">Grid</a></li>
225+
<li>
226+
<a routerLink="layout/back-to-top/infinite-scroll"
227+
>Infinite scroll</a
228+
>
229+
</li>
230+
<li><a routerLink="layout/back-to-top/repeater">Repeater</a></li>
231+
</ul>
232+
</li>
221233
<li>
222234
Box
223235
<ul>

apps/code-examples/src/app/features/layout.module.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import { NgModule } from '@angular/core';
22
import { RouterModule, Routes } from '@angular/router';
33

4+
import { BackToTopDemoComponent as BackToTopGridDemoComponent } from '../code-examples/layout/back-to-top/grid/back-to-top-demo.component';
5+
import { BackToTopDemoModule as BackToTopGridDemoModule } from '../code-examples/layout/back-to-top/grid/back-to-top-demo.module';
6+
import { BackToTopDemoComponent as BackToTopInfiniteScrollDemoComponent } from '../code-examples/layout/back-to-top/infinite-scroll/back-to-top-demo.component';
7+
import { BackToTopDemoModule as BackToTopInfiniteScrollDemoModule } from '../code-examples/layout/back-to-top/infinite-scroll/back-to-top-demo.module';
8+
import { BackToTopDemoComponent as BackToTopRepeaterDemoComponent } from '../code-examples/layout/back-to-top/repeater/back-to-top-demo.component';
9+
import { BackToTopDemoModule as BackToTopRepeaterDemoModule } from '../code-examples/layout/back-to-top/repeater/back-to-top-demo.module';
410
import { BoxDemoComponent } from '../code-examples/layout/box/basic/box-demo.component';
511
import { BoxDemoModule } from '../code-examples/layout/box/basic/box-demo.module';
612
import { BoxDemoComponent as InlineHelpBoxDemoComponent } from '../code-examples/layout/box/inline-help/box-demo.component';
@@ -17,6 +23,12 @@ import { TextExpandDemoComponent } from '../code-examples/layout/text-expand/inl
1723
import { TextExpandDemoModule } from '../code-examples/layout/text-expand/inline/text-expand-demo.module';
1824

1925
const routes: Routes = [
26+
{ path: 'back-to-top/grid', component: BackToTopGridDemoComponent },
27+
{
28+
path: 'back-to-top/infinite-scroll',
29+
component: BackToTopInfiniteScrollDemoComponent,
30+
},
31+
{ path: 'back-to-top/repeater', component: BackToTopRepeaterDemoComponent },
2032
{
2133
path: 'box/basic',
2234
component: BoxDemoComponent,
@@ -55,6 +67,9 @@ export class LayoutRoutingModule {}
5567

5668
@NgModule({
5769
imports: [
70+
BackToTopGridDemoModule,
71+
BackToTopInfiniteScrollDemoModule,
72+
BackToTopRepeaterDemoModule,
5873
BoxDemoModule,
5974
InlineHelpBoxDemoModule,
6075
DescriptionListDemoModule,

libs/components/layout/src/lib/modules/back-to-top/back-to-top.directive.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ export class SkyBackToTopDirective implements AfterViewInit, OnDestroy {
2929
* Specifies configuration options for the back to top component.
3030
*/
3131
@Input()
32-
public set skyBackToTop(value: SkyBackToTopOptions | undefined) {
33-
this.#buttonHidden = !!value?.buttonHidden;
32+
public set skyBackToTop(value: SkyBackToTopOptions | '' | undefined) {
33+
this.#buttonHidden = !!(value && value?.buttonHidden);
3434

3535
this.#handleBackToTopButton(this.#elementInView);
3636
}

0 commit comments

Comments
 (0)