Skip to content

Commit

Permalink
fix(button): fix dynamic disabled button
Browse files Browse the repository at this point in the history
  • Loading branch information
Enlcxx committed Dec 10, 2018
1 parent a755386 commit 4203625
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/lib/button/button.module.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { NgModule } from '@angular/core';
import { LyCommonModule } from '@alyle/ui';
import { LyButton } from './button';
import { LyButton, LyAnchor } from './button';

@NgModule({
exports: [LyButton, LyCommonModule],
declarations: [LyButton]
exports: [LyCommonModule, LyButton, LyAnchor],
declarations: [LyButton, LyAnchor]
})
export class LyButtonModule { }
35 changes: 33 additions & 2 deletions src/lib/button/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ mixinBg(
mixinDisableRipple(LyButtonBase)))))))));

@Component({
selector: '[ly-button]',
selector: 'button[ly-button]',
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: 'button.html',
inputs: [
Expand All @@ -67,7 +67,10 @@ mixinBg(
'elevation',
'shadowColor',
'disableRipple'
]
],
host: {
'[disabled]': 'disabled'
}
})
export class LyButton extends LyButtonMixinBase implements OnChanges, OnInit, AfterViewInit, OnDestroy {
/**
Expand Down Expand Up @@ -193,3 +196,31 @@ export class LyButton extends LyButtonMixinBase implements OnChanges, OnInit, Af
this._removeRippleEvents();
}
}

@Component({
selector: 'a[ly-button]',
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: 'button.html',
inputs: [
'bg',
'color',
'raised',
'disabled',
'outlined',
'elevation',
'shadowColor',
'disableRipple'
]
})
export class LyAnchor extends LyButton {
constructor(
_el: ElementRef,
_renderer: Renderer2,
_theme: LyTheme2,
_ngZone: NgZone,
_rippleService: LyRippleService,
_focusState: LyFocusState,
) {
super(_el, _renderer, _theme, _ngZone, _rippleService, _focusState);
}
}

0 comments on commit 4203625

Please sign in to comment.