Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/416.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用盎格鲁JS中继器将数据传递到基础模态中_Javascript_Angularjs_Zurb Foundation - Fatal编程技术网

Javascript 使用盎格鲁JS中继器将数据传递到基础模态中

Javascript 使用盎格鲁JS中继器将数据传递到基础模态中,javascript,angularjs,zurb-foundation,Javascript,Angularjs,Zurb Foundation,我正在为一个网站制作一个“会员”页面,其中有3列图片和每个会员的名字。我希望能够点击图片获得更多关于该成员的信息(通过基金会的模式)。我使用了一个转发器来显示图片,但我一直在研究如何将成员数据传递到模式中,这样当我单击person a时,模式中就会有person a的数据 以下是我到目前为止的情况: 我将成员作为json列表存储在members.json: { “当前”:[ { “姓名”:“鲍勃”, “图片”:http://www.placehold.it/300x300", “id”:“废话”

我正在为一个网站制作一个“会员”页面,其中有3列图片和每个会员的名字。我希望能够点击图片获得更多关于该成员的信息(通过基金会的模式)。我使用了一个转发器来显示图片,但我一直在研究如何将成员数据传递到模式中,这样当我单击person a时,模式中就会有person a的数据

以下是我到目前为止的情况:

我将成员作为json列表存储在
members.json

{
“当前”:[
{
“姓名”:“鲍勃”,
“图片”:http://www.placehold.it/300x300",
“id”:“废话”,
“职位”:“职位1”,
“简历”:“你好,我是鲍勃”
},
{
“姓名”:“鲍比”,
“图片”:http://www.placehold.it/300x300",
“id”:“废话”,
“职位”:“职位2”,
“简历”:“你好,我是鲍比”
}
]
}
这是我的控制器,使用json文件:

var-app=angular.module('app').controller('memberCtrl',['$scope','$http',函数($scope,$http){
"严格使用",;
$http.get('/data/members.json').success(函数(数据){
$scope.members=数据;
$scope.numColumns=3;
$scope.current_rows=[];
$scope.current_rows.length=Math.ceil($scope.members.current.length/$scope.numColumns);
$scope.current_cols=[];
$scope.current_cols.length=$scope.numColumns;
});
}]);
这是我的html:


{{members.current[$parent.$index*numColumns+$index].name}
生物技术

{{members.current[$parent.$index*numColumns+$index].name} {{members.current[$parent.$index*numColumns+$index].position}
添加ng单击img中的属性:

<img ng-src="{{members.current[$parent.$index * numColumns + $index].pic}}" 
     ng-click="loadMember(members.current[$parent.$index * numColumns + $index]);"/>

酷!所以在控制器函数中,我做了
$scope.memberData=member在我的模式中,我尝试使用
{{{memberData.bio}

访问该值。然而,我得到了

哇!原来是
引起了问题。我将
ng控制器
移动到一个单独的div,它成功了!谢谢
$scope.loadMember = function (member) {
    //you should be able to access the current member
    console.log(member);
}