2

In my AngularJS template I have the following login input field section. It is currently autopopulating the input field with rather than the email address address, it is showing up as in the email field (rather than [email protected] etc..)

[object Object]

my template/view

<input ng-model="form.email" type="email" name="email" placeholder="Email" autocomplete="off">

The ng-model using the variable form.email (although I cannot see where exactly that is coming from yet) - what could be wrong?

5

1 Answer 1

2

Make sure that form.email should be a string not an object.

Working demo :

var app = angular.module('myApp',[]);

app.controller('MyCtrl',function($scope) {
    $scope.form = {
        email: "[email protected]"
    }
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="myApp" ng-controller="MyCtrl">
  <input ng-model="form.email" type="email" name="email" placeholder="Email" autocomplete="off">
</div>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.