0

how to create group of steps within step using angularjs , I mean steps inside step kind of wizard:

I know it can be done using the ng-route having three template and then each template holding group of steps but how to manage the data for the group of step to the next step ? :(

  • 1
    Please clarify. With a [minimal, complete, and verifiable example](http://stackoverflow.com/help/mcve). – tandrewnichols Apr 30 '15 at 20:06
  • Still not clear, sorry. Describe what you're trying to accomplish (in more detail) and what you've tried. Include some code. Give an example of the desired outcome. I just don't understand what you're asking to even know where to start an answer. – tandrewnichols Apr 30 '15 at 20:29
  • if you see this example http://plnkr.co/edit/M03tYgtfqNH09U4x5pHC?p=preview from scotch.io you will find three step , what I want is ,one of the step should have multiple steps before going to next step – vaibhav Rangole Apr 30 '15 at 20:35

1 Answers1

0

It sounds like you want to use ng-route with, presumably multiple controllers to drive each step, and your question is, where to put your data along the way, since each controller is an instance that gets tossed when you move from one to the next.

If I've understood properly, then you might consider using an angular factory to hold your data model. Then inject the factory into each controller along the way so it can read and write it's portion of the data to the factory . Factories are singletons and as such their state (and the state of your data) won't change as you navigate through the steps.

Here's a very simple service for holding data:

(function () {
    'use strict';

    angular.module('myApp').factory('myDataService',
    [function () {
        var factory = {
            someProperty: 'foo',
        };

        return factory;
    }]);
})();

In your controllers, inject myDataService and then you can get and set like so:

$scope.someProperty = myDataService.someProperty; //'foo'
myDataService.someProperty = 'bar';
$scope.someProperty = myDataService.someProperty; //'bar'
lwalden
  • 813
  • 7
  • 11