有一個角度形式,我傳遞到我的控制器中。在控制器中未定義的角度形式
當我打開瀏覽器檢查窗體時,它是未定義的。我試着改變表單的名稱,並移動表單標籤來包圍整個主體。這裏是我的形式:
<form layout-padding id="form-container" ng-controller="RegisterController as RgCtrl" layout="column" ng-cloak name="projectForm">
<div id="content-row-header">What is your email?</div>
<md-input-container class="md-block md-input-focused">
<label>Email</label>
<input required type="email" name="email" ng-model="email"
minlength="10" maxlength="100" ng-pattern="/^[email protected]+\..+$/" />
<div ng-messages="projectForm.email.$error" role="alert">
<div ng-message-exp="['required', 'minlength', 'maxlength', 'pattern']">
Your email must be between 10 and 100 characters long and look like an e-mail address.
</div>
</div>
</md-input-container>
<div id="content-row-header">Set a password</div>
<md-input-container class="md-block md-input-focused">
<label>Password</label>
<input required name="password" ng-model="password">
<div ng-messages="projectForm.password.$error">
<div ng-message="required">This is required.</div>
</div>
</md-input-container>
</form>
這裏是我的函數調用:
<md-button id="orange-button" ui-sref="app.unauthenticated.purchase.agent" ng-click="doRegistration(projectForm)" flex>Create Account</md-button>
,這裏是我的控制器:
(function() {
'use strict';
angular
.module('app.auth.register')
.controller('RegisterController', RegisterController);
/** @ngInject */
function RegisterController($scope, $auth, $log, $location,$rootScope,$state,app_auth,$stateParams) {
// Data
var vm = this;
// Methods
$scope.doRegistration = function (form) {
console.log(form);
app_auth.register(form.email.$viewValue,form.password.$viewValue,form.passwordConfirm.$viewValue);
};
// $scope.goHome = function() {
/
/ $state.go('app.public');
// };
}
})();
現在時的console.log(表格)運行,表格未定義
$ state.go(」 app.public');應該評論? –
剛剛發佈了一個答案,請問你可以添加'md-input-container'的片段 –