0

This is the code:

<div ng-repeat="data in products">
    <div class=edit ng-click="dataUI.showEdit = true; content = data;">
    </div>
    <div ng-repeat="renew in data.renewed">
        <div class=edit ng-click="dataUI.showEdit = true; content = renew;">
        </div>
    </div>
</div>
<div class="modal" ng-show="dataUI.showEdit">
    <div class="product_price">{{content.product_price}}</div>
</div>

When I click this, the popup opens but, the content is not filled with items. In the popup, I am using content to show the data.

What am I doing wrong here?

JSFiddle: http://jsfiddle.net/HB7LU/22082/

7
  • 1
    Post a fully sufficient, independent question Commented Jan 12, 2016 at 18:52
  • 1
    Can you provide a jsfiddle? Commented Jan 12, 2016 at 18:53
  • Edited the question. Commented Jan 12, 2016 at 18:57
  • The value for your ng-repeat attribute should be enclosed in quotes - is this a typo? Commented Jan 12, 2016 at 18:58
  • Yeah, that was a typo. Fixed. Commented Jan 12, 2016 at 18:59

1 Answer 1

1

Here's your fiddle fixed: http://jsfiddle.net/masa671/xtaa9gev/

You were using an old version of Angular, changed to version 1.4.8 (see the JavaScript Gear).

Then, a couple of missing injections:

MyCtrl.$inject = ['$scope'];
myApp.controller('MyCtrl', MyCtrl);

Finally, assignment to content in ng-click did not work, because ng-repeat creates a new scope ("Always use a dot"). I fixed this with dataUI.content. Here is one good explanation: Ng-click doesn't work inside ng-repeat.

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

2 Comments

You beat me to it :-)
Sorry, I finalized my answer just 3 mins after your comment and saw it after posting my answer :-)

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.