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

AngularJs:单击该文本将文本设置为文本框-AngularJs:SetTexttoaTextBoxbyClickOnThatText

IwanttosendatexttoatextboxonthatText1Click我想在“text1”点击时发送文本到文本框Hereismycode:这

I want to send a text to a textbox on that "Text 1" Click

我想在“text 1”点击时发送文本到文本框

Here is my code:

这是我的代码:

HTML:

HTML:


   


    

And Here is the Output:

这是输出:

enter image description here

I want to send this Text 1 to a TextBox Input on that "Text 1" Click ("Button is that magnifier glass")

我想把这个文本1发送到文本框的输入上点击“文本1”(“按钮是放大镜”)

1 个解决方案

#1


2  

You can use something like this :

你可以这样使用:

Bind both select and input to the same ngModel:

将选择和输入绑定到同一个ngModel:

Note: Given the logic here. CSS and other dropdown related changes i didn't make. In controller:

注意:根据这里的逻辑。CSS和其他我没有做的相关的下拉修改。控制器:

On click of li ,the text value will be displayed in input text box.

单击li,文本值将显示在输入文本框中。

    angular.module('app', []).controller('dummy', function($scope) {
              $scope.call= function(event){
              $scope.valueText = angular.element(event.target).text();
              }
            });


    

Hope this helps..!

希望这有助于. . !


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