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

Stepper header without icons #10513

Closed
narthur157 opened this issue Mar 21, 2018 · 4 comments · Fixed by #10516
Closed

Stepper header without icons #10513

narthur157 opened this issue Mar 21, 2018 · 4 comments · Fixed by #10516
Assignees
Labels
feature This issue represents a new feature or feature request rather than a bug or bug fix P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@narthur157
Copy link

narthur157 commented Mar 21, 2018

Bug, feature request, or proposal:

Bug/feature request

What is the expected behavior?

Just display numbers in stepper headers

What is the current behavior?

Tries to display "create" in the icon after changing to another step

What are the steps to reproduce?

https://stackblitz.com/edit/angular-vpoj5j you can see it here

What is the use-case or motivation for changing an existing behavior?

Not everyone uses the icons

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Current. 5.2.4

Is there anything else we should know?

I know I can override the icons, however I'm unsure about changing it to always using the 'number' state.
The UX of changing the stepper to these icons doesn't really appeal to me.

@narthur157
Copy link
Author

narthur157 commented Mar 21, 2018

There is a simple enough workaround, but it is not especially pretty:

@ViewChild(MatHorizontalStepper) stepper: MatHorizontalStepper;


ngAfterViewInit() {
  this.stepper._getIndicatorType = () => 'number';
}

It is actually sort of frightening that this is permissible by ts

@mmalerba mmalerba added feature This issue represents a new feature or feature request rather than a bug or bug fix P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent labels Mar 21, 2018
@mmalerba
Copy link
Contributor

I think we could allow more flexibility with matStepperIcon if we added a let- binding on the directive so that people can have access to the step in the icon template. That should be able to support this use case as well as other things people may want to do. We should also allow people to specify a custom icon for the number steps, if we don't do that already. I think it only supports overriding edit and complete right now.

@crisbeto this sound reasonable to you?

@crisbeto
Copy link
Member

I avoided adding the ability to override the number icon, because I wasn't sure how people would be able to do custom numbering @mmalerba, but your suggestion for adding a template context variable would work.

@narthur157 you can still replace the edit and done icons with blank ones. Note that the feature was added in Material 5.2.0, whereas your example is based on 5.1.0:

<mat-horizontal-stepper>
  <ng-template matStepperIcon="edit"></ng-template>
  <ng-template matStepperIcon="done"></ng-template>

  <mat-step>...</mat-step>
</mat-horizontal-stepper>

@crisbeto crisbeto self-assigned this Mar 21, 2018
crisbeto added a commit to crisbeto/material2 that referenced this issue Mar 21, 2018
… context variables

* Allows for the step number icon to be overwritten using `matStepperIcon="number"`.
* Exposes the `index`, `active` and `optional` template variables to `matStepperIcon`.

Fixes angular#10513.
crisbeto added a commit to crisbeto/material2 that referenced this issue Mar 21, 2018
… context variables

* Allows for the step number icon to be overwritten using `matStepperIcon="number"`.
* Exposes the `index`, `active` and `optional` template variables to `matStepperIcon`.

Fixes angular#10513.
crisbeto added a commit to crisbeto/material2 that referenced this issue Mar 22, 2018
… context variables

* Allows for the step number icon to be overwritten using `matStepperIcon="number"`.
* Exposes the `index`, `active` and `optional` template variables to `matStepperIcon`.

Fixes angular#10513.
josephperrott pushed a commit that referenced this issue Mar 27, 2018
… context variables (#10516)

* Allows for the step number icon to be overwritten using `matStepperIcon="number"`.
* Exposes the `index`, `active` and `optional` template variables to `matStepperIcon`.

Fixes #10513.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature This issue represents a new feature or feature request rather than a bug or bug fix P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
3 participants