Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ####Go to next steps using AngularJS####
- First write the controller part:
- galleryApp.controller('rizCtrl', ['$scope', function($scope, $http) {
- //Current step and previous step action
- $scope.currentStep = 1;
- $scope.previousStep = 0;
- $scope.setStep = function(step) {
- if(step == 1) {
- $scope.previousStep = 0;
- }else {
- $scope.previousStep = $scope.currentStep;
- }
- $scope.currentStep = step;
- }
- });
- ###Then inside the html (view) do the followings###
- 1. Take page 2 inside this div and use ng-if to assign the currentStep (for now you can use 1):
- <div ng-if="currentStep == 1">
- 2. Add ng-click inside the button div (Next button)
- <div class="button" ng-click="setStep(2)">
- 3. Take page 4 inside this div and use ng-if to assign the currentStep (for now you can use 2):
- <div ng-if="currentStep == 2">
- 4. For back button use previousStep:
- <div class="button" ng-if="previousStep > 0" ng-click="setStep(previousStep)">
- Thanks!!!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement