Passing extra information to the child nodes.

158 views
Skip to first unread message

mendapa...@gmail.com

unread,
Jul 20, 2012, 6:09:46 AM7/20/12
to ang...@googlegroups.com
Hi all,

We are implementing a big application using angular.js. The application has some complex forms dynamically generated from the JSON data coming from the server.

The directive that generates the HTML template from the JSON is attaching some extra information to the generated dom elements as data. The next directive that transcludes the generated template fails to copy the data associated with the child elements.

I found that the `JQLiteClone` function simply uses native `cloneNode(true)` method to clone the element and doesn't copy the data to the cloned elements. I have reported an issue here https://github.com/angular/angular.js/issues/1124 and proposed a fix (https://github.com/angular/angular.js/pull/1188).

I don't want to spoil the scope as the information is only meant for a particular element. Any thoughts?

Regards
--
Amit Mendapara

mendapa...@gmail.com

unread,
Jul 23, 2012, 4:06:48 AM7/23/12
to ang...@googlegroups.com, mendapa...@gmail.com
Hello again,

Since this is really important for my project I need some thoughts & suggestions. Anyone from Angular team have idea why the data is not copied?

Regards
--
Amit Mendapara
Message has been deleted
Message has been deleted

Peter Bacon Darwin

unread,
Jul 24, 2012, 2:54:08 PM7/24/12
to ang...@googlegroups.com
I think the problem is that it is over our head and we don't have many ideas to help!

On 24 July 2012 16:33, Amit Mendapara <mendapa...@gmail.com> wrote:
Hi all,

This groups is quite active but not sure why my post is ignored. May be because of the subject line. Anyway, here is a link to the fiddle:

http://jsfiddle.net/wg7rk/13/

The first directive `myDynForm` dynamically generates template from the given json data and attaching some extra information to the elements. The next directive `myHorizontalLayout` then generates actual form layout (we have several different layout directives). The `myInput` directive again utilizing the data attached to the element to perform some tasks.

This is the simplest example. Our actual use cases are complex with nested forms/widgets (multiple levels). So we are afraid of spoiling the scope as it may be accidentally read/overwritten by child scopes.

Any thoughts?

Regards
--
Amit Mendapara  

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/f435kfzyW5kJ.

To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.

Reply all
Reply to author
Forward
0 new messages