试试这个。希望这是你的功能之后:
<td data-title="'ID'" ng-mouseover="test(batch)" ng-mouseleave="testLeave(batch)">
<div ng-show="batch.showId">{{batch.id}}</div>
<div ng-show="batch.toggle">
<a>Upload</a> <a ng-href="/batches/{{batch.id}}">View</a>
</div>
</td>
$scope.test = function (batch) {
batch.showId = false;
batch.toggle = true;
}
$scope.testLeave = function (batch) {
batch.showId = true;
batch.toggle = false;
}
$scope.batches = [
{id: "2014BATCH50", status: "QC in Progress. Illumina: 24/50", date: "10/24/14", qlty: "check", illumina: "none, raw, modified, modified", FX: "modified", showId: true, toggle: false},
{id: "2014BATCH49", status: "Pre-Extraction", date: "10/24/14", qlty: "check", illumina: "none, raw, modified, modified", FX: "modified", showId: true, toggle: false}
];
我减少了批次的数量只是为了提高速度。分配一个showId和toggle属性到每个批次并直接对它们进行处理。您可以折叠此为$ scope.searchFeature结构也一样,如果你喜欢:
$scope.searchFeature = {
showSearch: false,
addBatchButton: true,
test:function(batch) {
batch.showId = false;
batch.toggle = true;
}
}
市右垣九HarishR我用searchFeature.test(),但它不工作,你可以看到,当我们使用 $ scope.test其作用是显示在每个批次ID upload.view 但是当我们使用searchFeature.test()没有变化再次出现在batchId 看到plunker http://plnkr.co/edit/gklQvFUUvx4maIczOUA2 – SamiMalik
结帐[新plunker]( http://plnkr.co/edit/ylaA08iV760MVS5WzYQn?p=preview) – harishr
只有小问题当鼠标悬停事件发生时,Batchid没有隐藏 我的意思是在屏幕上显示upload/view时,应该隐藏batchId。 – SamiMalik