Fixed bugs by soul4code · Pull Request #92 · angular-wizard/angular-wizard · GitHub
Skip to content

Fixed bugs - #92

Open
soul4code wants to merge 1 commit into
angular-wizard:masterfrom
soul4code:master
Open

soul4code wants to merge 1 commit into
angular-wizard:masterfrom
soul4code:master

Conversation

@soul4code

Copy link
Copy Markdown
  • random order of load/add steps when using templates for wzStep directive
  • Nested wizards. Loading childwizard steps directive before run directive link function.

- random ordering when using templates for step directive
- Nested wizards. Loading childwizard steps  directive before run directive link function.
@jacobscarter

Copy link
Copy Markdown
Collaborator

@raftheunis87

Copy link
Copy Markdown

@jacobscarter Any news on the merge? I currently have the following issue:

<wizard on-finish="finishedWizard()" hide-indicators="true" current-step="currentPage"> <wz-step title="{{page.label}}" ng-repeat="page in pages | orderBy:sequenceSort" class="clearfix"> <div ng-repeat="question in page.questions"> <question my-question="question" my-assignment-id="assignmentId" page="page" ng-model="question" class="questionMargin"></question> </div> {{page.sequence}} <button class="btn btn-primary pull-left" ng-click="cancel()">Annuleer</button> <button class="btn btn-primary pull-right" type="submit" wz-next>Volgende</button> </wz-step> </wizard>

The ng-repeat gets an ordered data-set. I even added an extra orderBy to make sure everything is ordered, but the steps still are randomly shown.

@nfantone

Copy link
Copy Markdown

@raftheunis87 That should work. Your ng-repeat is iterating over an array declared on your controller (pages), while the wizard keeps its own array in its own isolated scope. Steps get added as soon as each wzStep directive is created, and since you are ordering the steps declaration they should show accordingly.

Try using single quotes in the orderBy filter.

ng-repeat="page in pages | orderBy:'sequenceSort'"

(see the docs: https://docs.angularjs.org/api/ng/filter/orderBy)

@lauraschoebel

Copy link
Copy Markdown

is there any development on this? I'm having a similar issue with my wizard consisting of 3 steps, where the 2nd step is an ng-repeat. Due to issues discussed above the wizard orders it Step 1, Step 3, and then the Step 2 ng-repeats. I saw that the fix above contains a solution with orderIndex but the current version doesn't seem to support his yet. Any help would be appreciated.

@jacobscarter

Copy link
Copy Markdown
Collaborator

Can you fix merge conflicts, I will get it merged after, sorry for the huge delay

Comment thread src/step.js
$scope.title = $scope.title || $scope.wzTitle;
wizard.addStep($scope);

//for nested wizards. Add step when tempate for wizard is ready.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

template not tempate

Comment thread src/step.js
}
else {
$rootScope.$on('mgo-angular-wizard.transcluded', function($event, wzName){
if (wizard.name==wzName) wizard.addStep($scope);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

please use {} in your if statement. Please add space on either side of ==

Comment thread src/wizard.js

link: function($scope, $element, $attributes){

var get_stepnodes = function (parent)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

{ on same like as argument declaration please

Comment thread src/wizard.js
{
var matchingElements = [];
var allElements = parent[0].getElementsByTagName('*');
for (var i = 0, n = allElements.length; i < n; i++)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

for (var i = 0; i < allElements.length; i++)

Comment thread src/wizard.js
for (var i = 0, n = allElements.length; i < n; i++)
{
var current = allElements[i],
$current = angular.element(current);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

declare variable, correct whitespace.

Comment thread src/wizard.js
$current = angular.element(current);

if (!_.isUndefined($current.attr('wz-step')) || current.nodeName.toLowerCase()=='wz-step' || $current.hasClass('step'))
{

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

{ on same line as ()

Comment thread src/wizard.js
var thisModule = this;

$scope.$watch('transcluded', function(val){
if (val) thisModule.transcluded = true;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

add {}

Comment thread src/wizard.js
//traverse steps array and set each "selected" property to false
_.each($scope.steps, function (step) {
step.selected = false;
if (step) step.selected = false;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

{} on new line

@jacobscarter

jacobscarter commented Jun 6, 2017 •

Copy link
Copy Markdown
Collaborator

@magnitronus can you please fix your syntax to match the coding style of the other contributors for consistency, can you please rebase your branch off our master so you will have the updates that fix issues with automated CI checks failing, can you please write unit tests to cover your new functionality, can you please remove the dist files from your PR, as a reminder we have our contribution guidelines here: https://github.com/angular-wizard/angular-wizard/blob/master/CHANGELOG.md

@nfantone

nfantone commented Jun 9, 2017

Copy link
Copy Markdown

@jacobscarter Sorry to intrude and jump in here, but... what if instead of you acting as a human linter, we actually configure and use one? From my humble POV, you cannot enforce a particular coding style to contributors when you yourself don't (or your project doesn't).

On a related note, if you want to avoid contributors/members pushing specific files to the repo, those should be clearly ignored in .gitignore. Otherwise, you'll most likely end up correcting this time and again. Besides, the fact that you are checking build results into the repository is odd/confusing, to say the least.

Also, the link to the contribution guidelines should be: https://github.com/angular-wizard/angular-wizard/blob/master/CONTRIBUTE.md. You pointed to the changelog there.

@jacobscarter

Copy link
Copy Markdown
Collaborator

@nfantone great points, would you like to make a PR updating the gitignore and adding jslint?

@jacobscarter

Copy link
Copy Markdown
Collaborator

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants