0

I have a modal to display some user information, much like a profile:

<!-- Modal --> <div id="modalBoy-z" class="modal hide fade in" style="display: none; "> <div class="modal-header"> <a class="close" data-dismiss="modal">×</a> <h3>User Profile</h3> </div> <div ng-controller=""> <h3>Name: </h3> <h3>Email: </h3> <h3>Join Date: </h3> <h3>Role: </h3> <h3>Status: </h3> </div> <div class="modal-footer"> <a href="#" class="btn" data-dismiss="modal">Close</a> </div> 

Here is the JSON object of the user information:

{ "id": "8311...", "meta": { "created": 1355860257840, "updated": 1355860257840 }, "profile": { "id": "https://project.dev:0000/profiles/admin", "type": "Profile", "vocSlug": "admin", "email": "[email protected]", "label": "System Administrator", "vocRole": [ "role_administrator", "system_administrator", "profile_administrator" ], "Status": "active" } }, 

How do I display the JSON object into the modal div? Would my ng-controller go in the div? I've just been using AngularJS for the past 3 weeks and am still getting accustomed with its MVC.

1 Answer 1

2

It is really easy to have two way data binding in AngularJS. However, generally speaking, only scope data is available for the data binding. I would highly recommend you to go through the AngularJS tutorial series.

http://docs.angularjs.org/tutorial/

Just go through all first few pages of the documentation and you will find the basic information to get started. Your enthusiasm to get things done is understandable but reading documentation is equally important.

Currently for your problem here is the simple solution. http://plnkr.co/edit/JG1bDjZgp9gsSiKSEmJB

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

1 Comment

Your addition to my code here: <div ng-controller="MainCtrl"> <h3>{{user.profile.id}} </h3> <h3>{{user.profile.email}}</h3> <h3>{{user.vocSlug}}</h3> <h3>{{user.profile.label}}</h3> <h3>{{user.profile.Status}}</h3> </div> Originally was also my first solution. At least I know I'm on the right path. Thanks for your support.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.