Generally speaking, that's the wrong way to do it. Check out TodoMVC, the Angular version for some specifics. But the idea is, you have an array of to-do items stored as a plain old javascript object. Pressing the button calls todos.push(new item). Add some other controls for editing or deleting objects from the array. Then you do an <div ng-repeat="todo in todos">, and you'll get one div per todo item, free and clear. Don't muck around with appendchild or any other direct DOM manipulation. You provide the data model, angular makes sure that the dom reflects that data model.
e On Thu, Jun 26, 2014 at 1:51 PM, ng-user <[email protected]> wrote: > Hi, > > I'm trying to make a task management site and I want to create a feature > where users can click on a button and that will create a new div for them > or a new object for them which they can edit by adding a title and > description. And they can create as many as they want. > > Can anyone help me to understand how I can do this as I am new to angular > I can't figure it out. > > I thought about creating an object and using a append.child function to > create editable objects dynamically. > > Can anyone please help?? > > Thanks in advance. > > -- > You received this message because you are subscribed to the Google Groups > "AngularJS" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/angular. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
