Research
Security News
Malicious PyPI Package ‘pycord-self’ Targets Discord Developers with Token Theft and Backdoor Exploit
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
angular-wizard
Advanced tools
Angular-wizard is a component that will make it easy for you to create wizards in your app. You can check a running example of the wizard by clicking here
You can download this by:
bower install angular-wizard
npm install angular-wizard
<!-- Use LATEST folder to always get the latest version-->
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/angular-wizard@latest/dist/angular-wizard.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/angular-wizard@latest/dist/angular-wizard.min.css">
<!-- Or use TAG number for specific version -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/angular-wizard@1.1.1/dist/angular-wizard.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/angular-wizard@1.1.1/dist/angular-wizard.min.css">
The dist folder contains the following files:
Angular-wizard depends on Angular.
The first thing we need to do is add a dependency to angular-wizard module which is called mgo-angular-wizard
.
We can do this simply by doing:
angular.module('your-app', ['mgo-angular-wizard']);
Now, in some HTML for a controller, you can just add a wizard as follows:
<wizard on-finish="finishedWizard()" on-cancel="cancelledWizard()">
<wz-step wz-title="Starting">
<h1>This is the first step</h1>
<p>Here you can use whatever you want. You can use other directives, binding, etc.</p>
<input type="submit" wz-next value="Continue" />
</wz-step>
<wz-step wz-title="Continuing">
<h1>Continuing</h1>
<p>You have continued here!</p>
<input type="submit" wz-next value="Go on" />
</wz-step>
<wz-step wz-title="More steps">
<p>Even more steps!!</p>
<input type="submit" wz-next value="Finish now" />
</wz-step>
</wizard>
This will look like the following when you're in the second step:
Let's go step by step to see how this works.
wizard
directive. This wizard directive, has the following options as attributes:ng-click
ng-click
WizardHandler
which we'll explain later.ng-model
) and that property will always have the name of the current step being shown on the screen.wz-next
attribute. That means that clicking that button will send the user to the next step of wizard. Similar to wz-next
, we have the following attributes:wz-next
it'll be the same as putting wz-finish
as the wizard will know we're at the last screen.All of this attributes can receive an optional function to be called before changing the step. Something like:
<input type="button" wz-next="setMode(mode)" value="Next" />
In this case, the setMode
function will be called before going to the next step.
A step can be conditionally disabled and may change at any time either adding it or removing it from the wizard step flow.
Example
HTML
<wizard on-finish="finishedWizard()" on-cancel="cancelledWizard()">
<wz-step wz-title="Starting" wz-disabled="{{disabled}}">
<h1>This is the first step</h1>
<p>Here you can use whatever you want. You can use other directives, binding, etc.</p>
<input type="submit" wz-next value="Continue" />
</wz-step>
<wz-step wz-title="Continuing">
<h1>Continuing</h1>
<p>You have continued here!</p>
<input type="submit" wz-next value="Go on" />
</wz-step>
<wz-step wz-title="More steps">
<p>Even more steps!!</p>
<input type="submit" wz-next value="Finish now" />
</wz-step>
</wizard>
Controller
//this will cause the step to be hidden
$scope.disabled = 'true';
The wzStep directive has the following options as attributes:
Example
HTML
<wizard on-finish="finishedWizard()" on-cancel="cancelledWizard()">
<wz-step wz-title="Starting" canexit="exitValidation">
<h1>This is the first step</h1>
<p>Here you can use whatever you want. You can use other directives, binding, etc.</p>
<input type="submit" wz-next value="Continue" />
</wz-step>
<wz-step wz-title="Continuing" canenter="enterValidation">
<h1>Continuing</h1>
<p>You have continued here!</p>
<input type="submit" wz-next value="Go on" />
</wz-step>
<wz-step wz-title="More steps">
<p>Even more steps!!</p>
<input type="submit" wz-next value="Finish now" />
</wz-step>
</wizard>
Controller
$scope.enterValidation = function(){
return true;
};
$scope.exitValidation = function(){
return true;
};
//example using context object
$scope.exitValidation = function(context){
return context.firstName === "Jacob";
}
//example using promises
$scope.exitValidation = function(){
var d = $q.defer()
$timeout(function(){
return d.resolve(true);
}, 2000);
return d.promise;
}
If a step requires information from a previous step to populate itself you can access this information through the context
object. The context object is automatically passed in as an argument into your canexit and canenter methods. You can access the context objext from your controller via: WizardHandler.wizard().context
There are some times where we actually want to manipulate the wizard from the controller instead of from the HTML.
For those cases, we can inject the WizardHandler
to our controller.
The main function of this service is the wizard(name)
which will let you get the wizard to manipulate it. If you have just one wizard in the screen and you didn't set a name to it, you can just call it as wizard()
. Let's see an example:
<wz-step wz-title="Cool step">
<input type="submit" ng-click="changeLabelAndGoNext()" />
</wz-step>
// In your controller
$scope.changeLabelAndGoNext = function() {
$scope.model.label = "Hola Gonto";
WizardHandler.wizard().next();
}
In this case, we're changing a label and moving forward on the steps.
The functions available in the wizard()
are:
true
will make ALL steps accessible, setting edit mode to false
will make all steps with an index lower than the latest "completed" step accessible.Angular Wizard emits the following events on the scope
and pass an object with the step info and the index as argument:
wizard:stepChanged
: When succeed changing the current stepwizard:stepChangeFailed
: When changing step and either fails canexit
of leaving step or canenter
of arriving step.$scope.$on('wizard:stepChanged',function(event, args) {
console.log(args);
}
Any changes you wish to make to the navigation bar can be done by overwritting the CSS. Because everyone wants the navigation bar in a different location and in a different style we have provided a default which you can change via your own HTML and CSS. The navigation bar shown below works in the following way:
All of those colors are variables in the angular-wizard.less
. You can easily change them by importing the angular-wizard.less
file into your own less file(s) and change the variables.
The available variables are:
You can check out a live sample of the Wizard clicking here
Releases notes are together with releases in GitHub at: https://github.com/angular-wizard/angular-wizard/releases
The MIT License
Copyright (c) 2013-2014 Martin Gontovnikas http://www.gon.to/
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Easy to use Wizard library for Angular JS
The npm package angular-wizard receives a total of 1,120 weekly downloads. As such, angular-wizard popularity was classified as popular.
We found that angular-wizard demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.