无法通过angularJS将数据从数组加载到jquery移动对话框页面

时间:2014-06-09 17:14:59

标签: javascript angularjs jquery-mobile jquery-mobile-listview

我练习angularJS和jquery mobile。我将本地存储的json文件(此处使用数组)加载到我的应用程序,并在列表视图中显示一些基本信息。我想在用户点击JQM dialog中的内容后,在listview页面\框中显示更详细的信息。现在我能够在listview中呈现基本信息,但对下一步非常无能为力。请指教。 我当时认为我拥有的一个控制器可以管理两个页面,但这显然是错误的。

JS代码:

var myCuponApp = angular.module("cupon", []);

myCuponApp.controller("controller", function ($scope) {
        $scope.itemSet = [{"id": 1, "cuponName": "Nikola Tesla", "age": "45"}];
});

html代码:

<head ng-app="cupon">
    <div data-role="page" id="scientists" ng-controller="controller">
        <div data-role="header"><h3>great scientists</h3></div>

        <div data-role="content">
                <div>
                    <ul data-role="listview" data-inset="true" data-filter="true">
                        <li ng-repeat="item in itemSet" data-role="button"><a href="#sc" data-rel="dialog">{{item.cuponName}}</a></li>
                     </ul>
                 </div>
         </div>
     </div>

    <div data-role="page" id="sc" ng-controller="controller">
        <div>{{item.cuponName}}</div>
    </div>
</head>

0 个答案:

没有答案