1
How to proceed to perform a Submit with Onsen UI + Angularjs?
I got the following ons-page:
<ons-page ng-controller="LoginController">
<ons-toolbar>
<div class="center">Acesso ao Sistema</div>
</ons-toolbar>
<form action="@Url.Action("Login", "Account")" method="post" id="loginForm"
class="login-form">
@Html.AntiForgeryToken()
@Html.ValidationSummary(true, "")
@Html.EditorFor(m => m.Email, new { htmlAttributes = new {
@class = "text-input--underbar",
placeholder = "E-mail",
autofocus = "autofocus"
} })
@Html.ValidationMessageFor(m => m.Email)
@Html.PasswordFor(m => m.Password, new {
@class = "text-input--underbar",
placeholder = "Senha"
})
@Html.ValidationMessageFor(m => m.Password)
<br><br>
<ons-button modifier="large" class="login-button">Login</ons-button>
<br><br>
<ons-button modifier="quiet" class="forgot-password">
Esqueceu sua senha?
</ons-button>
</form>
</ons-page>
@section scripts {
<script src="~/Static/js/controllers/loginController.js"></script>
}
Plugins render in required order:
<script src="/Static/vendor/angular/angular.min.js"></script>
<script src="/Static/vendor/onsenui/js/onsenui.min.js"></script>
<script src="/Static/js/controllers/loginController.js"></script>
Content of loginController.js
:
(function () {
var module = ons.bootstrap("loginModule", ["onsen"]);
//module.controller("AppController", function ($scope) { });
//module.controller("MainController", function ($scope) { });
module.controller("LoginController", function ($scope) { });
})();
You want to submit and process the login via AJAX or simply submit the form in the normal way?
– AlfredBaudisch
@Alfred, at first the traditional way. I don’t know how to do it because Onsenui doesn’t generate a Ubmit button. Grateful
– JamesTK