TypeError:无法读取未定义的属性“电子邮件”-AngularJS

时间:2019-05-22 16:34:10

标签: javascript angularjs

控制器

angular.module('onboardingApp').controller('userInfoController',
    ['$scope', '$location', 'apiService','$log' ,'$q',
    function($scope, $location, apiService, $log, $q) {


        $scope.user = {email: $scope.user.email, password: $scope.user.password};


    }]);

HTML

<div class="row" ng-controller="userInfoController">
    <div class="col-sm-10 col-sm-offset-1">
        <div class="row">
            <div class="form-box col-sm-12">
                <h3>User Information</h3>
                <form method="POST" action="#" accept-charset="UTF-8" class="form-horizontal" role="form">

                    <input name="_token" type="hidden" value="123">

                    <div class="form-group">
                        <label class="col-sm-3 control-label">Email Address</label>
                        <div class="col-sm-7">
                            <input ng-model="user.email"  type="email" name="email" class="form-control" required="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">Password</label>
                        <div class="col-sm-7">
                            <input ng-model="user.password" type="password" name="password" class="form-control" required="">
                        </div>
                    </div>

                    <h1>{{user.email}} \ {{user.password}} </h1>

                    <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-8">
                            <a ng-click="changeView('service-plan')" class="btn btn-success mb25 pull-right">Next</a>
                            <a ng-click="changeView('welcome')" class="btn btn-primary mb25 pull-right mr15">Back</a>
                        </div>
                    </div>

                </form>
            </div>
        </div>

 </div>
</div>

结果

enter image description here

enter image description here

我以为我已经init在这里完成了

  

$ scope.user = {电子邮件:$ scope.user.email,密码:$ scope.user.password};

是否有进一步调试的提示?

0 个答案:

没有答案