miraxes / angular-custom-tour

Custom tour hints
24 stars 12 forks source link

tour-step doesn't works with ngFor #7

Closed guilhermejcgois closed 6 years ago

guilhermejcgois commented 6 years ago

Why do u get {selector, order} from DOM node here instead from anchors? We can't use a ngfor like that:

<tour-step *ngFor="let item of items" [order]="item.order" [selector]="item.selector" [position]="item.position">
  <tour-step-item [items]="items" [order]="item.order" [current]="currentStep" (reduce)="reduce($event)"></tour-step-item>
</tour-step>
miraxes commented 6 years ago

Thanks for using it, my friend! I don't really remember the reason >_< but that was something about avoid bugs for missing steps, and double checking everything...

So the problem is when using ngFor [selector] is missing on attrs Here is workaround for you.

<tour-step *ngFor="let item of items" [attr.selector]="item.selector" [selector]="item.selector" ....>
   ...
</tour-step>

[selector] -> is for navigating on steps [attr.selector] -> is for initialize

Let me know if it working for you, please!

miraxes commented 6 years ago

Well, closing this one.

@guilhermejcgois You can suggest changes if you find better way of service initialize.

guilhermejcgois commented 6 years ago

Hey, sorry for the delay... Your workaround works! I was thinking about the implementation, seems to me a little confuse get order and selector from DOM instead using the anchors property, can't be dangerous if both desynchronizes?