Skip to content

Commit 7fff2cd

Browse files
authored
Merge pull request #48 from guillemc23/patch-2
fix: Angular snippets for Indicator
2 parents 7bf1f63 + 6eccc1a commit 7fff2cd

File tree

3 files changed

+36
-9
lines changed

3 files changed

+36
-9
lines changed

demo-snippets/ng/indicator/indicator.component.html

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@
44
</ActionBar>
55

66
<StackLayout>
7-
<Pager [items]="items" height="300" [selectedIndex]="selectedIndex" (selectedIndexChange)="onIndexChanged($event)"
8-
indicator="fill" showIndicator="true">
9-
<ng-template let-i="index" let-item="item">
10-
<GridLayout [backgroundColor]="item.color">
11-
<Label class="label" [text]="item.title"></Label>
12-
</GridLayout>
13-
</ng-template>
14-
</Pager>
7+
<GridLayout>
8+
<Pager id="pager" [items]="items" height="300" [selectedIndex]="selectedIndex" (selectedIndexChange)="onIndexChanged($event)">
9+
<ng-template let-i="index" let-item="item">
10+
<GridLayout [backgroundColor]="item.color">
11+
<Label class="label" [text]="item.title"></Label>
12+
</GridLayout>
13+
</ng-template>
14+
</Pager>
15+
<PagerIndicator pagerViewId="pager" type="thin_worm" verticalAlignment="bottom" horizontalAlignment="center"
16+
marginBottom="10" color="#C3AEC6" selectedColor="#77567a" />
17+
</GridLayout>
1518
<Button text="Reset" (tap)="resetPager()"></Button>
1619
</StackLayout>

demo-snippets/ng/install.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { NO_ERRORS_SCHEMA, NgModule } from '@angular/core';
2-
import { NativeScriptCommonModule, NativeScriptModule } from '@nativescript/angular';
2+
import { NativeScriptCommonModule, NativeScriptModule, registerElement } from '@nativescript/angular';
33

44
import { PagerModule } from '@nativescript-community/ui-pager/angular';
5+
import { PagerIndicator } from "@nativescript-community/ui-pager-indicator";
6+
registerElement("PagerIndicator", () => PagerIndicator)
57

68
import { StaticPagerComponent } from './static-pager/static-pager.component';
79
import { BasicPagerComponent } from './basic-pager/basic-pager.component';

packages/ui-pager-indicator/blueprint.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,28 @@ Run the following command from the root of your project:
2828
PagerIndicator add page control for Pager or other Paging Views.
2929
```
3030

31+
## Usage in Angular
32+
33+
34+
If you are planning to use an indicator, add the following to your module:
35+
36+
```typescript
37+
import { registerElement } from "@nativescript/angular";
38+
import { PagerIndicator } from "@nativescript-community/ui-pager-indicator";
39+
registerElement("PagerIndicator", () => PagerIndicator)
40+
```
41+
42+
Then in your template:
43+
```html
44+
<Pager id="pager" [items]="items"
45+
...
46+
</Pager>
47+
<PagerIndicator pagerViewId="pager" />
48+
```
49+
50+
### Examples
51+
- [Indicator Pager](demo-snippets/ng/indicator)
52+
- A simple pager example using dynamic content and indicator.
3153

3254
## Usage in Vue
3355

0 commit comments

Comments
 (0)