사용자가 양식에 입력 한 데이터를 저장할 수 없습니다. 이것은 각 단계가 각도 UI 라우터를 사용하여보기로 포함 된 다단계 형식입니다. 데이터를 저장해야하는 객체를 기록했지만 비어 있습니다. 그래서 난 그냥 하나를 게시하고Angular.js UI 라우터를 사용하여 작성된 다중 단계 데이터의 데이터를 저장할 수 없습니다.
var app = angular.module("Signup", ['ui.router', "ngAnimate"]);
app.config(function($stateProvider,$urlRouterProvider) {
$urlRouterProvider.otherwise('/index/signup');
$stateProvider
.state('index', {
url: '/index',
templateUrl: 'index.html',
controller: 'FormCtrl'
})
.state('index.signup', {
url: '/signup',
templateUrl: 'views/signup.html',
controller: 'FormCtrl'
})
.state('index.otp', {
url: '/otp',
templateUrl: 'views/otp.html',
controller: 'FormCtrl'
})
.state('index.password', {
url: '/password',
templateUrl: 'views/password.html',
controller: 'FormCtrl'
})
.state('index.identity', {
url: '/identity',
templateUrl: 'views/identity.html',
controller: 'FormCtrl'
})
.state('index.done', {
url: '/done',
templateUrl: 'views/done.html',
controller: 'FormCtrl'
});
});
app.controller("FormCtrl", ["$scope", "$location", "$window", "dataService", function($scope, $location, $window, dataService) {
$scope.newuser = dataService.newuser;
if(document.getElementById('showPswd')) {
document.getElementById('showPswd').addEventListener("click", function() {
var pwd = document.getElementById("newPassword");
if (pwd.getAttribute("type") === "password") {
pwd.setAttribute("type", "text");
} else {
pwd.setAttribute("type", "password");
}
});
}
if(document.getElementById('last')) {
console.log(dataService.newuser.firstname);
setTimeout(function() {
$window.open('http://www.ayushdevelops.com/');
}, 10000);
}
$scope.go = function(path) {
$location.path(path);
};
}]);
app.factory('dataService', function() {
return {
newuser: {}
};
});
내 모든보기이 페이지를 채울 싶지 않아요.
<div id="wrapper-signup">
<h1>Borrower Signup</h1>
<p>Register and start borrowing money online.</p>
<div class="element-wrap">
<label>NAME<br>
<div class="name-wrap">
<input type="text" ng-model="newuser.firstname" name="firstname" id="firstname" value="" placeholder="First Name">
<input type="text" ng-model="newuser.lastname" name="lastname" id="lastname" value="" placeholder="Last Name">
</div>
</label><br>
</div>
<div class="element-wrap">
<label for="email">EMAIL
<div class="email-num-wrap">
<span class="awesome-icon"><i class="fa fa-envelope-o fa-lg email-icon" aria-hidden="true"></i></span><input type="email" id="email" ng-model="newuser.email" name="email" value="" placeholder="Email ID" required>
</div>
<p class="error" style="color: red; font-size: 0.8em;" ng-show="signForm.email.$invalid && signForm.email.$dirty">Enter a valid email</p>
</label>
</div>
<div class="element-wrap">
<label>MOBILE NUMBER
<div class="email-num-wrap">
<span class="awesome-icon"><i class="fa fa-mobile fa-2x mobile-icon" aria-hidden="true"></i></span><input type="number" id="number" ng-model="newuser.number" name="mobile-number" value="" placeholder="Enter 10 digit number">
</div>
</label>
</div>
<div class="clear">
</div>
<div class="checkbox-wrap">
<input type="checkbox" class="checkbox" name="terms" value="" ng-model="tcheck" required><p class="checkbox-text">I have read and agree to the <a href="#">Privacy Policy</a>, <a href="#">Terms of Use</a> and consent to Electronic Disclosures.</p>
</div>
<div class="checkbox-wrap">
<input type="checkbox" class="checkbox" name="condiiton" value="" ng-model="ccheck" required><p class="checkbox-text">I authorize RupaiyaExchange to share my details with other Financial Institutions for credit card check and faster processing of loan.</p>
</div>
<a ui-sref='index.otp' ng-show="signForm.email.$valid && tcheck && ccheck" class="submit-signup">SIGNUP</a>
</div>
서비스가 그 시점에서 정확한 데이터를 가지고있는 경우'을 console.log (dataService.newuser)를 넣어보십시오'$의 scope.newuser''에 할당하기 전에 확인합니다. – georgeawg