У меня есть шаг мастера, который содержит несколько представлений с разными контроллерами, но мой мастер - это контроллер нагрузки в первый раз, после чего, если я нажимаю «Далее / предыдущий», контроллер для каждого мастера не загружается снова. Как загрузить контроллер каждого вида, когда я нажимаю кнопку «Следующая / Предыдущая»?
WizardTemplate:
<div class="tiga-flex-stretched tiga-flex-parent">
<div id="wizard-container" class="tiga-flex-stretched tiga-flex-parent">
<div id="wizard-step-container" class="tiga-flex-fixed">
<ul class="nav nav-pills nav-justified">
<li ng-repeat="step in Steps" ng-class="{'active':step.step == CurrentStep}"><a href="">{{step.step}}. {{step.name}}</a></li>
</ul>
</div>
<div id="wizard-content-container"class="tiga-flex-stretched tiga-flex-parent" >
<div dynamic-ctrl="GetControllerTemplate()" class="tiga-flex-stretched tiga-flex-parent">
<ng-include src="GetStepTemplate()" class="tiga-flex-stretched tiga-flex-parent"></ng-include>
</div>
</div>
</div>
</div>
здесь следующий / предыдущий код шага:
<button ng-disabled="CurrentStep <= 1" class="btn btn-default" name="previous" type="button" ng-click="GoToStep(CurrentStep - 1)"><i class="fa fa-arrow-left"></i> Previous step</button>
<button ng-disabled="CurrentStep >= Steps.length" class="btn btn-primary" name="next" type="button" ng-click="GoToStep(CurrentStep + 1)">Next step <i class="fa fa-arrow-right"></i></button>
Wizard.Js:
function Main()
{
GenerateSteps();
}
function GenerateSteps()
{
for( var i = 0; i < _wizardTemplate.length; i++ )
{
var template = _wizardTemplate[ i ];
$scope.Steps.push( { step : i + 1, name : template.stepsName, template : template.viewTemplate + '.html', controller : template.controllerTemplate } );
}
}
function GoToStep( newStep )
{
$scope.CurrentStep = newStep;
}
function GetStepTemplate()
{
for( var i = 0; i < $scope.Steps.length; i++ )
{
if( $scope.CurrentStep == $scope.Steps[ i ].step )
{
var path = "Modules/CustomActions/Templates/" + $scope.Steps[ i ].template;
return path;
}
}
}
function GetControllerTemplate()
{
for( var i = 0; i < $scope.Steps.length; i++ )
{
if( $scope.CurrentStep == $scope.Steps[ i ].step )
{
return $scope.Steps[ i ].controller;
}
}
}