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

Step symbol template #149

Merged
merged 2 commits into from Sep 27, 2018
Merged

Conversation

earshinov
Copy link
Contributor

PR #144 rebased onto 'develop' branch.

…ar template.

For example:

```
<div awWizardStep>
   <ng-template awWizardStepTitle>
       Address information
   </ng-template>
   <ng-template awWizardStepSymbol>
       <i class="fa fa-taxi"></i>
   </ng-template>
</div>
```

TODO:
- Document in the main README.md
- Add an example in the [demo app](https://github.com/madoar/angular-archwizard-demo/)
@earshinov earshinov changed the base branch from master to develop September 26, 2018 12:52
@earshinov earshinov mentioned this pull request Sep 26, 2018
<div *ngIf="step.stepSymbolTemplate" class="step-indicator">
<ng-container [ngTemplateOutlet]="step.stepSymbolTemplate.templateRef"></ng-container>
</div>
<div *ngIf="!step.stepSymbolTemplate" class="step-indicator"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason, why we don't implement this similar to the step title?
To clarify what I mean, I would expect something like this:

<div class="step-indicator">
        <ng-container *ngIf="step.stepSymbolTemplate" [ngTemplateOutlet]="step.stepSymbolTemplate.templateRef"></ng-container>
        <ng-container *ngIf="!step.stepSymbolTemplate" [ngStyle]="{ 'font-family': step.navigationSymbol.fontFamily }">{{step.navigationSymbol.symbol}}</ng-container>
</div>

Is this possible?

Copy link
Contributor Author

@earshinov earshinov Sep 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ng-container is a 'virtual' Angular component that does not have a corresponding element in the DOM, so [ngStyle] would not be able to put style="" anywhere and it would have no effect. Demo:
https://stackblitz.com/edit/angular5-template-oc4v8z?file=src/app/app.component.html

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right, thanks for reminding me :)
Is there a way to structure it a little bit better, I mean two of the four lines are almost the same...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. Please take a look at 9651d50.

@@ -13,11 +13,10 @@
<ng-container *ngIf="step.stepTitleTemplate" [ngTemplateOutlet]="step.stepTitleTemplate.templateRef"></ng-container>
<ng-container *ngIf="!step.stepTitleTemplate">{{step.stepTitle}}</ng-container>
</div>
<div *ngIf="step.stepSymbolTemplate" class="step-indicator">
<ng-container [ngTemplateOutlet]="step.stepSymbolTemplate.templateRef"></ng-container>
<div class="step-indicator" [ngStyle]="{ 'font-family': step.stepSymbolTemplate ? '' : step.navigationSymbol.fontFamily }">
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be initial instead of ''?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'initial' will override user-defined styles, which, I believe, would be an unintended behavior.
Demo: https://stackblitz.com/edit/angular5-small-demos

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so basically, if an empty string is passed to a css attribute in [ngStyle] it is ignored/removed?

Copy link
Contributor Author

@earshinov earshinov Sep 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually a feature of DOM API. When you assign an empty value to el.style.property, the CSS property is actually removed. Demo: https://jsfiddle.net/tcaz6kqu/

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I didn't know that.

Copy link
Owner

@madoar madoar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please also add a short example for this feature to the demo repository?

@madoar madoar merged commit 640ffee into madoar:develop Sep 27, 2018
@earshinov
Copy link
Contributor Author

Can you please also add a short example for this feature to the demo repository?

@madoar, Yes, will do today or tomorrow.

@earshinov earshinov deleted the develop-step-symbol-template branch September 28, 2018 11:02
@earshinov
Copy link
Contributor Author

For the demo, please see
madoar/angular-archwizard-demo#24

@madoar madoar mentioned this pull request Oct 29, 2018
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.

None yet

2 participants