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
<ng-template appNgLoop #nr [appNgLoopOf]="numbers"> | |
<div> | |
{{ nr }} - Foo | |
</div> | |
</ng-template> |
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 *appNgLoop="let nr of numbers; index as i"> | |
{{ nr }} - Foo | |
Index: {{ i }} | |
</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
ngOnChanges() { | |
this.container.clear(); | |
for (const input of this.appNgLoopOf) { | |
this.container.createEmbeddedView(this.template, { | |
$implicit: input, | |
index: this.appNgLoopOf.indexOf(input), | |
}); | |
} | |
} |
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
ngOnChanges() { | |
for (const input of this.appNgLoop) { | |
this.container.createEmbeddedView(this.template); | |
} | |
} |
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
export class NgLoopDirective implements OnInit { | |
constructor(private container: ViewContainerRef, | |
private template: TemplateRef<any>, | |
) { } | |
ngOnInit(): void { | |
this.container.createEmbeddedView(this.template); | |
} | |
} |
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
import { Directive } from '@angular/core'; | |
@Directive({ | |
selector: '[appNgLoop]' | |
}) | |
export class NgLoopDirective { | |
constructor() { } | |
} |
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
// Future versions of Hyper may add additional config options, | |
// which will not automatically be merged into this file. | |
// See https://hyper.is#cfg for all currently supported options. | |
module.exports = { | |
config: { | |
// Choose either "stable" for receiving highly polished, | |
// or "canary" for less polished but more frequent updates | |
updateChannel: 'stable', |
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
this.locationService.go('item/12'); |
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
it('can fetch data with debounce (test scheduler)', () => { | |
const source = cold('a', { a: { type: actions.DATA_WITH_DEBOUNCE_FETCH } }); | |
mockObservableWithScheduler(getTestScheduler()); | |
const effect = new AppTimeEffect(new Actions(source)); | |
// - is a 10 frame interval, since we use 100 in the effect we use 10 - characters | |
const expected = cold('----------a', { a: { type: actions.DATA_WITH_DEBOUNCE_FETCH_SUCCESS } }); | |
expect(effect.fetchDataWithDebounce$).toBeObservable(expected); | |
}); |
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
it('can fetch data with debounce (mocking debounce)', () => { | |
const source = cold('a', { a: { type: actions.DATA_WITH_DEBOUNCE_FETCH } }); | |
mockObservable(); | |
const effect = new AppTimeEffect(new Actions(source)); | |
const expected = cold('a', { a: { type: actions.DATA_WITH_DEBOUNCE_FETCH_SUCCESS } }); | |
expect(effect.fetchDataWithDebounce$).toBeObservable(expected); | |
}); |