上,我采用了棱角分明JS向导:角JS NG-如果链路
var myApp = angular.module('myApp', []);
myApp.controller('WizardController', ['$scope', function($scope){
$scope.user = {};
}]);
我有这个下拉菜单的位置:
<select ng-model="user.agree">
<option>Yes</option>
<option>No</option>
</select>
,如果用户选择是,我想这个链接出现:
<a ng-click="gotoNextStep()"
ng-show="showNextButton()"
ng-if="user.agree == 'Yes'">Next</a>
但是,当我到这一步,按钮不会出现在所有。我得到ng-if
工作在<p ng-if="user.agree == 'Yes'">Blah Blah Blah</p>
但由于某种原因,它不工作的链接。
gotoNextStep和showNextButton在myApp.directive('wizard', function(){
之内,我的输入和链接在我的<wizard>
之内,我已经定义了ng-app和wizardController。
这些是我的功能(以防万一):
$scope.showNextButton = function() {
return $scope.currentStepIndex > (1) && $scope.currentStepIndex < ($scope.steps.length - 1);
}
$scope.gotoNextStep = function() {
toggleSteps($scope.currentStepIndex + 1);
}
你的链接标记是什么样的? – Jerrad
你可以通过plunkr或jsfiddle分享吗? –
我的链接标记,当我检查元素看起来像这样'<! - ngIf:user.agree =='是' - >'怪异 – user3618922