{"action":"created","issue":{"url":"https://api.github.com/repos/troch/angular-multi-step-form/issues/44","repository_url":"https://api.github.com/repos/troch/angular-multi-step-form","labels_url":"https://api.github.com/repos/troch/angular-multi-step-form/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/troch/angular-multi-step-form/issues/44/comments","events_url":"https://api.github.com/repos/troch/angular-multi-step-form/issues/44/events","html_url":"https://github.com/troch/angular-multi-step-form/issues/44","id":156258805,"number":44,"title":"Access $nextStep() in controller function","user":{"login":"jpduckwo","id":13150911,"avatar_url":"https://avatars.githubusercontent.com/u/13150911?v=3","gravatar_id":"","url":"https://api.github.com/users/jpduckwo","html_url":"https://github.com/jpduckwo","followers_url":"https://api.github.com/users/jpduckwo/followers","following_url":"https://api.github.com/users/jpduckwo/following{/other_user}","gists_url":"https://api.github.com/users/jpduckwo/gists{/gist_id}","starred_url":"https://api.github.com/users/jpduckwo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpduckwo/subscriptions","organizations_url":"https://api.github.com/users/jpduckwo/orgs","repos_url":"https://api.github.com/users/jpduckwo/repos","events_url":"https://api.github.com/users/jpduckwo/events{/privacy}","received_events_url":"https://api.github.com/users/jpduckwo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-23T11:27:17Z","updated_at":"2016-05-24T07:33:53Z","closed_at":null,"body":"Hi, \r\n\r\nI'm wondering if it's possible to trigger the $scope.$nextStep() and other step functions inside the controller. When I do this it complains that it is undefined. I've tried injecting in various step scopes etc but it doesn't seem to help.\r\n\r\nOn of my use cases for this would be to write generic next and back functions that can be embedded in a partial for a menu that can be used across different types of multi step forms. Then I would define different step flows by looking up the step number and figuring out the next step base on either some variables in the step config or something like that. \r\n\r\nIf I can figure out how to call $nextStep in the controller triggered by a wrapping function, I think I'll be able to figure the rest out! Many thanks on your great work with this module it's awesome.\r\n\r\nE.g. \r\n```\r\nmyApp.controller('AddController', ['$scope', function($scope) {\r\n    init();\r\n\r\n    function init() {\r\n        $scope.model = {};\r\n\r\n        $scope.steps = [{\r\n            templateUrl: 'step1.html',\r\n            title: 'asdf'\r\n        }, {\r\n            templateUrl: 'step2.html',\r\n            title: 'qwer'\r\n        }, {\r\n            templateUrl: 'step3.html',\r\n            title: 'zxvc'\r\n        }];\r\n    }\r\n\r\n    $scope.selectPerson = function(person) {\r\n        $scope.model.person = person;\r\n        $scope.$nextStep();\r\n    };\r\n}]);\r\n```\r\n\r\nIn the view:\r\n\r\n```\r\n...\r\n<div class=\"peoplelist\">\r\n    <div ng-repeat=\"person in peopleList|filter:search\" class=\"person\" ng-click=\"selectPerson(person); $nextStep();\"> /* I don't want to have to call $nextStep() here, and have it trigger by the selectPerson() method */\r\n</div>\r\n...\r\n```"},"comment":{"url":"https://api.github.com/repos/troch/angular-multi-step-form/issues/comments/221189086","html_url":"https://github.com/troch/angular-multi-step-form/issues/44#issuecomment-221189086","issue_url":"https://api.github.com/repos/troch/angular-multi-step-form/issues/44","id":221189086,"user":{"login":"troch","id":1777517,"avatar_url":"https://avatars.githubusercontent.com/u/1777517?v=3","gravatar_id":"","url":"https://api.github.com/users/troch","html_url":"https://github.com/troch","followers_url":"https://api.github.com/users/troch/followers","following_url":"https://api.github.com/users/troch/following{/other_user}","gists_url":"https://api.github.com/users/troch/gists{/gist_id}","starred_url":"https://api.github.com/users/troch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/troch/subscriptions","organizations_url":"https://api.github.com/users/troch/orgs","repos_url":"https://api.github.com/users/troch/repos","events_url":"https://api.github.com/users/troch/events{/privacy}","received_events_url":"https://api.github.com/users/troch/received_events","type":"User","site_admin":false},"created_at":"2016-05-24T07:33:53Z","updated_at":"2016-05-24T07:33:53Z","body":"> When I tried to follow the method from the saving-data example it complained that multiStepFormScope doesn't exist...\r\n\r\n`multiStepFormInstance`, not `multiStepFormScope` :D.\r\n\r\n>  however it doesn't appear I need to do this?\r\n\r\nYou don't have to inject `multiStepFormInstance`, $scope has the main methods from it (prefixed with `$`). So it depends on your use case.\r\n\r\n> I'm wondering if it's possible to trigger the $scope.$nextStep() and other step functions inside the controller.\r\n\r\n> If I can figure out how to call $nextStep in the controller triggered by a wrapping function\r\n\r\nI'm not sure I fully understand what you are trying to accomplish. It seems you are trying to control the multi step form instance from outside the directive?"}}
{"actor":{"display_login":"troch"}}