There are a few issues in your code. - $scope object need to be injected into the controller function - todos, getTotalTodos, addTodo, clearCompleted need to be wrapped inside the controller - var todos should come before this.product = todos instead of after, todos hasn't been defined at this point - In the HTML ng-repeat, product in store.todos, should be product in store.products. The repeat iterate through each items in the products object. I think you're trying to go for the dot naming style, which is good practice. You'll need to declare the store object in the controller, then assign the todos to store.products.
Here's a working version of the code: http://codepen.io/anon/pen/dbGoD On Monday, June 30, 2014 3:22:07 AM UTC-7, ng-user wrote: > > Hi, > > I found the following code online http://codepen.io/Russbrown/pen/IgBuh and > I noticed that it is not based on a module creation so I decided to change > it into a module. But after editing the code it does not work. I have > attached the code that I edited and the original is in the link above. Can > anyone tell me what did I do wrong? > > I was trying to convert the original code to a module based code as I read > that creating module based code is a very good habit and helps testing. > > *note: I only edited the index.html and todo.js file.* > > Thanks in advance. > > Best Regards > > > > -- 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.
