im建立了2个数据列表的测试应用程序。在ng-click上将值传递给模态窗口
1) books
2) borrower details
我列出所有可用的书籍,如果它已经借来的,我会让他们与地位的名字借用
我想要实现的是,
当我列出所有书籍,用户将能够点击并且引导模式将出现。现在它显示了书上的细节。但如果这本书已经借了,我需要向借款人显示详细信息,例如姓名,身份证号码以及书籍详情。
这是我曾尝试
HTML
<div class="available" ng-repeat="book in books" ng-click="popup(book)">
{{book.book_name}}
<div ng-repeat="borrower in borrowers">
<div class="not_available" ng-show="borrower.book_id==book.book_id>
{{book.book_name}} is already borrowed by {{borrower.name}}
</div>
</div>
的JavaScript
function libcontroller($scope, $modalInstance, book)
{
$scope.book = book;
}
function testcontroller($scope, $timeout, $modal, $log) {
$scope.books = []; // custom to pull books from the database
$scope.borrowers = []; // custom to pull books from the database
// MODAL WINDOW
$scope.popup = function(_book) {
var modalInstance = $modal.open({
controller: "libcontroller",
templateUrl: 'myContent.html',
resolve: {
book: function()
{
return _book;
}
}
});
};
}
如何才能实现这一目标?
谢谢
什么不起作用? – devqon