我是AngularJS的新手。任何人都可以告訴我如何在另一個控制器的作用域函數中調用自定義指令。如何在另一個控制器的示波器功能中調用自定義指令
比如我有一個功能的控制器如下:
angularApp.controller('sample_Ctrl', function ($scope, $http, $timeout, $rootScope, $location) {
$scope.showReport = function(id) {
};
});
我創建了一個customDirective如下:
var showModalDirective = function ($timeout) {
return {
restrict: 'E',
templateUrl: '/Partials/template1.html',
};
};
angularApp.directive('showModal', showModalDirective);
那麼如何調用此指令showReport
功能,以及如何我可以將id傳遞給模板URL嗎?
你的問題不明確。你能添加一些上下文/例子嗎? –
**你打電話給**是什麼意思? – Mehraban
我添加了一個例子,你們可以現在檢查 – user1268130