0

我有一个模式来显示一些用户信息,很像个人资料:

<!-- 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> 

这是用户信息的 JSON 对象:

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

如何将 JSON 对象显示到模态 div 中?我的 ng-controller 会进入 div 吗?在过去的 3 周里,我一直在使用 AngularJS,并且仍然习惯了它的 MVC。

4

1 回答 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

于 2013-02-01T22:55:22.217 回答