动态创建HTML元素 [英] create HTML element dynamically

查看:134
本文介绍了动态创建HTML元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很新的角度JS。我想创建于特定的div点击输入框。在这里,我需要创建一个重复的div元素。

I am very new to angular js. I want to create an input box on click of particular div. Here I need to create element on div which repeating.

<div><div ng-repeat ng-click="create();"></div><div>

会有什么这样做的最佳方式?

What will be the best way to do so?

推荐答案

在角DOM操作是通过指令完成结果(上有创建一个用于操纵DOM一个指令这里的段落)

DOM manipulation in Angular is done via directives
(There is paragraph on 'Creating a Directive that Manipulates the DOM' here)

首先,通读这个优秀的文章:<一href=\"http://stackoverflow.com/questions/14994391/how-do-i-think-in-angularjs-if-i-have-a-jquery-background\">How我现在想的角度,如果我有一个jQuery的背景

First, read through this excellent article: How do i think in Angular if i have a jQuery background

该角团队还提供了pretty整齐的教程,这是definetly值得一看:的http:// docs.angularjs.org/tutorial

The Angular Team also provides a pretty neat tutorial, which definetly is worth a look: http://docs.angularjs.org/tutorial

虽然角为pretty容易和有趣的使用,一旦你缠的概念你的头,它可以是相当压倒性潜入寒冷。启动慢,不要尝试使用每个功能从此开始。读了很多。

While Angular is pretty easy and fun to use once you have wrapped your head around the concepts, it can be quite overwhelming to dive into the cold. Start slow and do not try to use each and every feature from the beginning. Read a lot.

我强烈建议 egghead.io 作为学习资源。本视频教程有一口大小,易于观看和理解。初学者和中间体的好地方。从这里底层做起。

I strongly recommend egghead.io as a learning resource. The video-tutorials there are bite-sized and easy to watch and understand. A great place for both beginners and intermediates. Start from the bottom here.

有些人曾与角度做伟大的事情。看看 http://builtwith.angularjs.org/ 并检查了一些源$ C ​​$ C。

Some folks have done great things with Angular. Take a look at http://builtwith.angularjs.org/ and check out some source code.

这篇关于动态创建HTML元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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