1
如果用戶擁有「否」單選選項選擇的按鈕,我怎麼重定向到/註冊?
ROUTE
// app/routes/users.js
app.post('/users/session', passport.authenticate('local', {
failureRedirect: '/signin',
failureFlash: true
}), users.session);
VIEW
<form action="https://stackoverflow.com/users/session" method="post">
<input ng-change="change()" ng-model="NotSureWhatToPutHere" type="radio" name="optionsRadios" id="optionsRadios1" value="option1" checked>
<label for="optionsRadios1">
No, I am a <b>new customer</b>.
</label>
<input type="radio" ng-model="NotSureWhatToPutHere" ng-change="change()" name="optionsRadios" id="optionsRadios2" value="option2">
<label class="control-label" for="optionsRadios2">
Yes, I have a password:
</label>
<button type="submit">Sign in</button>
</form>
CONTROLLER
// controllers/index.js
'use strict';
angular.module('mean.system').controller('IndexController', ['$scope', 'Global', function ($scope, Global) {
$scope.global = Global;
}]);
我加了NG-變化中的index.html。有沒有一個教程,我可以看看有關如何更改網址,而無需連接到服務器的更多信息? – user3373281
呃,很多方法。谷歌或Stackoverflow搜索「Javascript更改表單操作」應該有所幫助。 在您添加的版本中,您的$ scope.change函數應該看起來像function(){/ *如果是新客戶,請採取行動* /}。但是,如果你發佈角度控制器和更多的index.html,我可以幫助更多。 – Zlatko
哦,不,我的意思是角度控制器。你知道,客戶端的JavaScript? – Zlatko