Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(repeat): add Repeat directive #15

Closed
wants to merge 1 commit into from
Closed

feat(repeat): add Repeat directive #15

wants to merge 1 commit into from

Conversation

nartc
Copy link
Collaborator

@nartc nartc commented Sep 11, 2023

closes #14

This PR adds Repeat directive that extends NgFor. This directive allows consumers to iterate over a number of times instead of a list of items

<!-- before -->
<p *ngFor="let i of [0, 1, 2]">{{ i }}</p>

<!-- after -->
<p *ngFor="let i; repeat 3">{{ i }}</p>

@nartc nartc requested a review from eneajaho September 11, 2023 02:26
@nartc nartc self-assigned this Sep 11, 2023
@nx-cloud
Copy link

nx-cloud bot commented Sep 11, 2023

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 9774426. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 4 targets

Sent with 💌 from NxCloud.

nartc added a commit that referenced this pull request Sep 11, 2023
closes #15

This PR adds a utility function `assertInjector` that abstracts `assertInInjectionContext` and guarantees an `Injector` after the utility is invoked

```ts
function injectDummy(injector?: Injector) {
  injector = assertInjector(injectDummy, injector);
  // ^ injector is guaranteed to be an Injector
  runInInjectionContext(injector, () => {
    // always run in a particular Injector's context
  })
}
```
closes #14

This PR adds `Repeat` directive that extends `NgFor`. This directive allows consumers to iterate over a number of times instead of a list of items

```html
<!-- before -->
<p *ngFor="let i of [0, 1, 2]">{{ i }}</p>

<!-- after -->
<p *ngFor="let i; repeat 3">{{ i }}</p>
```
nartc added a commit that referenced this pull request Sep 11, 2023
closes #15

This PR adds a utility function `assertInjector` that abstracts `assertInInjectionContext` and guarantees an `Injector` after the utility is invoked

```ts
function injectDummy(injector?: Injector) {
  injector = assertInjector(injectDummy, injector);
  // ^ injector is guaranteed to be an Injector
  runInInjectionContext(injector, () => {
    // always run in a particular Injector's context
  })
}
```
@nartc nartc enabled auto-merge (squash) September 11, 2023 02:51
@nartc nartc closed this in e1570a6 Sep 11, 2023
auto-merge was automatically disabled September 11, 2023 08:20

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feat] add repeat directive
1 participant