我是离子,angularjs和Restangular的新手,我正在使用所有这些框架+ couchbase构建移动应用程序。我正在进行注册,我有点困惑。我尝试了这段代码,但它不起作用: 我创建了signup.html页面,如下所示
<ion-modal-view>
<ion-header-bar>
<h1 class="title">Sign in</h1>
<div class="buttons">
<button class="button button-clear" ng-click="closeSignin()">Close</button>
</div>
</ion-header-bar>
<ion-content>
<form ng-submit="doSignin()" name="form1">
<div class="list">
<label class="item item-input">
<span class="input-label">First Name</span>
<input type="text" ng-model="signinData.firstName" required>
</label>
<label class="item item-input">
<span class="input-label">Last Name</span>
<input type="text" ng-model="signinData.lastName" required>
</label>
<label class="item item-input">
<span class="input-label">Birth Day</span>
<input type="date" ng-model="signinData.birthday" required>
</label>
<label class="item item-input">
<span class="input-label">sex </span>
<ion-radio ng-model="signinData.sex" ng-value="'Male'">Male</ion-radio>
<ion-radio ng-model="signinData.sex" ng-value="'Female'">Female</ion-radio>
</label>
<label class="item item-input">
</label>
<label class="item item-input">
<span class="input-label">Email</span>
<input type="email" ng-model="signinData.email" required>
</label>
<label class="item item-input">
<span class="input-label">Password</span>
<input type="password" ng-model="signinData.password" required>
</label>
<label class="item">
<button class="button button-block button-positive" type="submit" >Sing in</button>
</label>
</div>
</form>
<div>
<button class="button button-block button-light" ng-click="facebookLogin()">
<i class="icon ion-social-facebook"></i>
Sign in with Facebook
</button>
</div>
</ion-content>
</ion-modal-view>`
我创建了一个控制器:
.controller('SigninCtrl',function($scope, $ionicModal, $timeout, $state, OpenFB){
$scope.signinData = [];
// signin model
$ionicModal.fromTemplateUrl('templates/signin.html', {
scope: $scope
}).then(function(modal) {
$scope.modal = modal;
});
// Triggered in the signiin modal to close it
$scope.closeSignin = function() {
$scope.modal.hide();
};
// Open the signin modal
$scope.signin = function() {
$scope.modal.show();
};
// Perform the signin action when the user submits the signin form
$scope.doSignin = function() {
console.log('Doing Sinin', $scope.signinData);
// Simulate a signin delay. Remove this and replace with your signin
// code if using a signin system
$timeout(function() {
$scope.closeSignin();
}, 1000);
};
})
这里是logIn.html表单,其中包含登录按钮,我希望它能引导我到signIn.html
<ion-modal-view>
<ion-header-bar>
<h1 class="title">Login</h1>
<div class="buttons">
<button class="button button-clear" ng-click="closeLogin()">Close</button>
</div>
</ion-header-bar>
<ion-content>
<form ng-submit="doLogin()" name="form1">
<div class="list">
<label class="item item-input">
<span class="input-label">Username</span>
<input type="text" ng-model="loginData.username" required>
</label>
<label class="item item-input">
<span class="input-label">Password</span>
<input type="password" ng-model="loginData.password" required>
</label>
<label class="item">
<button class="button button-block button-positive" type="submit" ng-disabled="form1.$invalid">Log in</button>
</label>
<label class="item">
<button class="button button-block button-positive" type="submit" ng-click="signin()" >Sign up</button>
</label>
</div>
</form>
<div>
<button class="button button-block button-light" ng-click="facebookLogin()">
<i class="icon ion-social-facebook"></i>
Login with Facebook
</button>
</div>
</ion-content>
</ion-modal-view>
但这不起作用我不知道我做错了什么 如果你有任何signin注册教程,请不要犹豫,将它链接进去,因为我仍然在我的开头,我无法找到一个完整的例子来清楚地理解每件事 谢谢!