0

I have a directive that injects a dynamic template on ng-repeat. I'm wanting to add to that list, which, I can, but for some reason none of the items I add to the list are reflected in the view. I know it's close, but I seem to be missing something.

I have created a fiddle with the code.

   $scope.

Any help is appreciated

3
  • Your fiddle is not working ! Commented Feb 11, 2014 at 10:05
  • Fix your fiddle please Commented Feb 11, 2014 at 10:13
  • I've tried everything to get that fiddle working. I'm not sure what's missing. Commented Feb 11, 2014 at 11:22

1 Answer 1

1

I'm not sure what you are trying to achieve, but injecting a template like that does not sound like a good idea. You can just use HTML and let AngularJS do the repeating/hiding/etc for you.

Also, every time you declare ng-controller in your HTML, a new instance of the controller is created. These instances do not share a common $scope and is probably not what you want either.

To fix AngularJS unable to inject the application module, I moved the binding of myApp to the body tag:

<body ng-app="myApp">

which I read about here.

I forked your fiddle to a working example: http://jsfiddle.net/42rpB/2/

Sign up to request clarification or add additional context in comments.

1 Comment

Hi there, thanks for answering my question. I did try to add the ng-app="myApp" to the fiddle but I see that you've removed the directive as well. Very nice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.