Angularjs向导隐藏wz-step

时间:2016-09-23 00:12:24

标签: angularjs wizard

如何根据上一步的值隐藏 wz-step

我的HTML:



<wizard on-finish="submit()" hide-indicators="true" currentStep="data"> 
 <wz-step wz-title="onestep">
  <p>Show two step?</p>
  <md-radio-group ng-model="data.question" class="md-primary">
		<md-radio-button ng-value="1"> Yes </md-radio-button>
		<md-radio-button ng-value="0"> No </md-radio-button>
  </md-radio-group>
  <md-button type="submit" wz-next>NEXT</md-button>
 </wz-step>
 <wz-step wz-title="twostep" ng-show="data.question == 1">
    //Two step, show if data.question = 1
 </wz-step>
 <wz-step wz-title="finalstep">
  <md-button type="submit" wz-next class="md-raised">Submit</md-button>
 </wz-step>
</wizard>
&#13;
&#13;
&#13;

我的js: scope.data = {         问题:0,     };

我试过ng-show和ng-if,ng-show总是显示,而ng-if永远不会:(

我希望你能提前帮助我。

2 个答案:

答案 0 :(得分:2)

当用户点击下一步时,您可以使用ng-hide。

例如:

 <div ng-hide = "show">
          <input type="text" ng-model="test"/>
 </div>

<input type="button" ng-click="MyFunction" value="Next">

控制器:

$scope.show = false;
$scope.MyFunction = function(){
    if($scope.test == null){ // or undefined...
          $scope.show = true;
    }
};

答案 1 :(得分:0)

请阅读缺少的文档 https://github.com/angular-wizard/angular-wizard 部分向导动态步骤 谢谢 Edith Capistran