Angularjs - 在我将一个值输入到 <intput> 之后带有 ng-model 的字段值更改为 undefined [英] Angularjs - after I enter a value into a <intput> field with ng-model the value changes to undefined

查看:16
本文介绍了Angularjs - 在我将一个值输入到 <intput> 之后带有 ng-model 的字段值更改为 undefined的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个接受输入的简单表单.出于某种原因,当我更改值时,范围变量更改为未定义.

I have a simple form that accepts an input. For some reason when I change the value the scope variable changes to undefined.

<body ng-controller="myctrler">
<input ng-model="t.unsubscribeEmail" type="email" class="textboxfields" placeholder="Enter email address">
</body>

在控制器中:

$scope.k=
{
    unsubscribeEmail : "not"
};

我在输入框中输入任何内容之前的值是not".只要我在输入中输入内容,值就会变为未定义.

The value before I enter anything into the inputbox is "not". As soon as I type something in the input the value changes to undefined.

我错过了什么?

推荐答案

更改您的输入类型文本或编写验证电子邮件

Change your input type text or write valide email

<input ng-model="t.unsubscribeEmail" type="text" class="textboxfields" placeholder="Enter email address">

或写验证电子邮件

<input ng-model="t.unsubscribeEmail" type="email" class="textboxfields" placeholder="Enter email address">

这篇关于Angularjs - 在我将一个值输入到 &lt;intput&gt; 之后带有 ng-model 的字段值更改为 undefined的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆