使用angularjs将数据绑定到元素 [英] Binding data to an element using angularjs

查看:104
本文介绍了使用angularjs将数据绑定到元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

我正在动态创建数字输入,我想将每个数字输入值绑定到它的相关p元素。我已经在 jsfiddle 中编写了代码。每个p元素都假设在数字输入中显示相关的选定数字,但事实并非如此。例如,如果我更改第一个数字输入值,它的p元素应该被更改并显示当前值,但是p元素没有被显示。

你可以请我的代码在哪里是错的?

最好的问候



我尝试过:



我已经用 jsfiddle 编写了我的代码。

Hello
I am creating numeric inputs dynamically and I want to bind each numeric input value to it's related "p" element. I have written the code in jsfiddle. each "p" element supposes to show the related selected number in the numeric input, but it doesn't. For example if I change the firs numeric input value, it's "p" element should be changed and show the current value, but "p" element is not being displayed.
could you please where in my code is wrong?
Best regards

What I have tried:

I have written my code in jsfiddle.

推荐答案

试试



try

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
     <script>
         var app = angular.module('myModule', []);
         app.controller('myController', function (


scope,


compile){


这篇关于使用angularjs将数据绑定到元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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