0
我想創建一個使用AngularJS狀態的嵌套窗體中的下一個按鈕。這是我設置的是:AngularJS狀態下一個按鈕
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('step', {
url: '/step',
templateUrl: 'form.html',
count: '0',
controller: 'formController'
})
.state('step.1', {
url: '/1',
count: '1',
templateUrl: 'form-1.html'
})
.state('step.2', {
url: '/2',
count: '2',
templateUrl: 'form-2.html'
})
.state('step.3', {
url: '/3',
count: '3',
templateUrl: 'form-3.html'
})
.state('step.4', {
url: '/4',
count: '4',
templateUrl: 'form-4.html'
});
$urlRouterProvider.otherwise('/step/1');
})
要我使用的是NG-點擊功能狀態之間進行切換:
$scope.nextStep = $state.current.count;
$scope.nextStepCount = function() {
$scope.count = $scope.nextStep + 1;
$state.go('step.' + $scope.count);
}
當我點擊下一步按鈕它改變的「步驟爲當前的路線。 1「到」step.11「。
字符串的串聯,而不是另外的數字是發生了什麼。 – Chris 2015-02-06 13:08:46