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

Apply the [stepId] field from the WizardSteps at ids in the navigation bar #186

Merged
merged 2 commits into from Mar 8, 2019

Conversation

madoar
Copy link
Owner

@madoar madoar commented Feb 5, 2019

This PR applies the [stepId] input field of the WizardSteps automatically as the id of the li elements in the navigation bar. This allows the user to change the navigation button style of individual steps.

@Gevko this should fix #183, it would be nice if you could give it a try to see if it works :)

Possible Issues

To set the id of the li elements in the navigation bar I've used [attr.id] instead of [id], because this leads to the removal of the id field in the DOM, when step.stepId``is set to nullorundefined. [id]in comparison seems to always add anidfield to the DOM even if the value is set tonullorundefined`.

As far as I know, it seems to be bad practice to use [attr.id] instead of [id], but it seems to result in the "cleanest" DOM in this case. Maybe someone more knowledgeable about the usage of attributes with Angular 2+ can shed some more light on this. (maybe @earshinov?)

@Gevko
Copy link

Gevko commented Feb 14, 2019

Will try this now, sorry I was busy last few days

@Gevko
Copy link

Gevko commented Feb 22, 2019

Well, i have the step, but how can I correctly change the style of the step?
@madoar

@madoar
Copy link
Owner Author

madoar commented Feb 22, 2019

In theory it should work with:

aw-wizard-navigation-bar.horizontal ul.steps-indicator li#customStep .step-indicator {
  border-color: violet !important;
  background-color: violet !important;
}

and

<aw-wizard-step stepTitle='Steptitle' [stepId]="customStep">Step 1</aw-wizard-step>

@Gevko
Copy link

Gevko commented Feb 25, 2019

This doesnt work for me.

I've tried the way you told me, but didnt worked. I've inspected the element and i've done a console.log of all li elements using const a = document.getElementsByTagName('li') and the li items that represent my steps dont have any id.
image
But if i achange the id manually with: a[72].attributes[1].ownerElement.id = 'customStep';
it works and the li has an id and the color of step is changed:
image

What I am doing wrong? Sorry for giving you this much work

@madoar
Copy link
Owner Author

madoar commented Feb 25, 2019

@Gevko I've just added a new PR to the demo/example repository, see madoar/angular-archwizard-demo#28. Can you give it a try to see if it works for you?

Please be aware that you need to build this PR and install it in the demo project, otherwise the feature won't work.

@Gevko
Copy link

Gevko commented Feb 25, 2019

Hey,
I've downloaded the demo and the PR (https://github.com/madoar/angular-archwizard-demo/tree/add-custom-step-css-demo). How should I install the PR into the demo? Since I am not able to build the PR using ng build

@madoar
Copy link
Owner Author

madoar commented Feb 25, 2019

  1. clone both angular-archwizard and angular-archwizard-demo
  2. checkout the corresponding branches, i.e.:
    • for angular-archwizard: apply-step-id-in-navigation-bar
    • for angular-archwizard-demo: add-custom-step-css-demo
  3. run npm run build in the angular-archwizard folder
  4. change "angular-archwizard": "^4.0.0", inside the package.json file inside the angular-archwizard-demo folder to "angular-archwizard": "path/to/angular-archwizard/dist",
  5. delete the package-lock.json file inside the angular-archwizard-demo folder (just to be sure)
  6. run npm install in the angular-archwizard-demo folder
  7. run ng serve in the angular-archwizard-demo folder
  8. access localhost:4200

@madoar madoar merged commit 73def2a into develop Mar 8, 2019
@madoar madoar deleted the apply-step-id-in-navigation-bar branch March 8, 2019 13:55
earshinov added a commit to earshinov/angular-archwizard that referenced this pull request Mar 17, 2019
* master:
  - adjust version - add angular version 7 to the keywords
  - fix badges in README
  Update to angular 7 (madoar#194)
  Update the badges (madoar#193)
  Cleanup .travis.yml (madoar#191)
  Remove unnecesarry index.ts files (madoar#192)
  Apply the [stepId] field from the WizardSteps at ids in the navigation bar (madoar#186)
  Update the index.ts files (madoar#187)
  Removing barrel export and explicitly exporting each component in base index.ts.  Barrel exports of components cause @ViewChild(<className>) to give undefined in AOT builds (madoar#184)
  Declare Angular 7 compatibility in `package.json` (madoar#165)
  Refactor styles (madoar#161)
  Restore vertical nav bar layout, in particular label alignment (madoar#159)
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.

Changing the step symbol background color programatically based on a condition
2 participants