This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component({ | |
selector: 'app-carousel', | |
template: `...` | |
}) | |
export class CarouselComponent { | |
@Input() autoplay: boolean; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<app-carousel [autoplay]="true"></app-carousel> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<app-carousel autoplay></app-carousel> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<app-counter value="10" tick="5"></app-counter> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private _value: number; | |
get value(): number { | |
return this._value; | |
} | |
@Input() | |
set value(value: number) { | |
this._value = coerceNumberProperty(value, 0); | |
} | |
private _tick: number; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component({ | |
selector: 'app-counter', | |
template: `...`, | |
}) | |
export class CounterComponent { | |
@Input() value: number; | |
@Input() tick: number; | |
decrement() { | |
this.value -= this.tick; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<app-counter [value]="100" [tick]="5"></app-counter> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private _autoplay: boolean; | |
get autoplay(): boolean { | |
return this._autoplay; | |
} | |
@Input() | |
set autoplay(value: boolean) { | |
this._autoplay = coerceBooleanProperty(value); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div *carousel="let image from images; let ctrl = controller"> | |
<img [src]="image"> | |
<button (click)="ctrl.prev()">Previous</button> | |
<button (click)="ctrl.next()">Next</button> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Directive({ | |
selector: '[carousel]' | |
}) | |
export class CarouselDirective implements OnInit, OnDestroy { | |
// ... | |
private _autoplayDelay: number; | |
@Input('carouselWithDelay') | |
set autoplayDelay(autoplayDelay: number) { | |
this._autoplayDelay = autoplayDelay; |