試試這個。希望這是你的功能之後:
<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