我有一组少数员工的信息,我想通过点击特定员工来显示他们的信息。
<md-whiteframe class="md-whiteframe-z1" layout="column" style="background-color:white; margin-top:30px; margin-bottom:30px;" ng-controller="listController">
<div layout="row" ng-repeat="x in names" style="border-bottom:1px solid #d5d5d5;" ng-click="showAdvanced($event,$index)">
<div class="" layout="column" style="">
<center class="list-title">
<img src="/app/img/adnan.jpg" alt="contact image" style="border-radius:50%; height:30px; width:30px; ">
<span style="margin-left: 8px;font-weight: bold;">{{ x.id }}</span>
</center>
</div>
<div class="" layout="column" style="margin:0px auto;text-align: justify;">
<label for="email" class="list-email" id="popupContainer">{{ x.name }}</label>
</div>
<div class="" layout="column">
<label for="phone-no" class="list-phn-no">{{ x.timeStamp }}</label>
</div>
</div>
</md-whiteframe>
这是我的index.html页面,当用户点击然后排一个标签将打开我已经完成的标签并将显示他们的信息。基于员工,信息将会改变。但我的问题是如何通过单击来检索用户。
<md-dialog aria-label="Mango (Fruit)">
<form>
<md-dialog-content style="max-width:800px;max-height:810px; color:green;" ng-controller="listController">
<div>
<p>
The mango is a juicy stone fruit belonging to the genus Mangifera, consisting of numerous tropical fruiting trees, cultivated mostly for edible fruit. The majority of these species are found in nature as wild mangoes. They all belong to the flowering plant family Anacardiaceae. The mango is native to South and Southeast Asia, from where it has been distributed worldwide to become one of the most cultivated fruits in the tropics.
</p>
<img style="margin: auto; max-width: 100px;" alt="Lush mango tree" src="/app/img/adnan.jpg">
<p>
The highest concentration of Mangifera genus is in the western part of Malesia (Sumatra, Java and Borneo) and in Burma and India. While other Mangifera species (e.g. horse mango, M. foetida) are also grown on a more localized basis, Mangifera indica—the "common mango" or "Indian mango"—is the only mango tree commonly cultivated in many tropical and subtropical regions.
</p>
<p>
It originated in Indian subcontinent (present day India and Pakistan) and Burma. It is the national fruit of India, Pakistan, and the Philippines, and the national tree of Bangladesh. In several cultures, its fruit and leaves are ritually used as floral decorations at weddings, public celebrations, and religious ceremonies.
</p>
</div>
</md-dialog-content>
这是我想要在index.html页面上显示要点击的用户的页面。这个过程是什么?
答案 0 :(得分:0)
你可以这么做,你在控制器中注入$ modal, 您的点击功能如下,您从html发送您的ID
showAdvanced = function (selectedItem) {
$modal.open({
templateUrl: 'your template path mean html',
backdrop: 'static',
controller: _userCtrl,
windowClass: 'modal-details',
resolve: {
params: function () {
return { user: selectedItem }
}
}
});
$event.stopPropagation();
};
您可以将其解析为控制器_userCtrl,它看起来像
var _userCtrl = ['$scope', '$modalInstance', 'params', function ($scope, $modalInstance, params) {
// you received your value in params, you can do it whatever you want, it will in params.user
}];