热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

如何将值从文本框传递到typescript文件-Howtopassvaluesfromtextboxtotypescriptfile

pleasehelpmehowcanipassmytextboxvaluestotypesccript请帮助我如何将我的文本框值传递给typesccript<div&

please help me how can i pass my textbox values to typesccript

请帮助我如何将我的文本框值传递给typesccript

Student.ts
this is my class its having Email And password this call i used in studentController

Student.ts这是我的班级,它有电子邮件和密码这个叫我在studentController中使用的电话

  export class Validationclass {
            Email: string;
            Password: string;
        }
export class studentController {
        public val: Validationclass;

        Validation() {
            if (this.val.Email != null && this.val.Password != null) {
                alert('ok')
            }
            else
                alert("Emptr");

        }

1 个解决方案

#1


0  

You need to assign the ngModel to the correct vars in your controller like this:

您需要将ngModel分配给控制器中的正确变量,如下所示:

Make sure in your controller to initialize the ValidationClass like this:

确保在控制器中初始化ValidationClass,如下所示:

ngOnInit() {
  val = new Validationclass(); 
}

推荐阅读
author-avatar
手机用户2502863361
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有