要求是直接从ng-click调用工厂方法吗?
ng-click="viewDocument(documentData.docId)"
答案 0 :(得分:1)
是的,如果您将工厂绑定到您的范围,如下所示:
$scope.factory = myFactory;
然后在你的模板中:
ng-click="myFactory.viewDocument(documentData.docId)"
或直接将函数绑定到您的范围:
$scope.viewDocument = myFactory.viewDocument;
并在您的模板中:
ng-click="viewDocument(documentData.docId)"