I have the following controller, and directive declaration.
<div ng-controller="DocumentController as dc" data-drop-zone url="api/document/upload">
How do I wire the document controller to call a method on the directive.
<button ng-click="dc.start()" />
drop-zone is typescript, defined as follows.
export class DocumentDropZone implements ng.IDirective {
url: string;
constructor(public $log, public $compile) {
}
public start(): void {
this.$log.log(`start processing files...`);
}
public link: Function = (scope: any, element: angular.IAugmentedJQuery, attrs: angular.IAttributes) => {
this.$log.log(`initialising drop zone`);
... // left out for brevity.
The document controller is simple.
class DocumentController
{
static $inject = ['$log'];
constructor(public $log: ng.ILogService) {
}
public start(): void {
// CALL THE DIRECTIVE "start" METHOD SOMEHOW...
this.$log.log(`start uploading files`);
}
}
If I attempt to use an isolated scope on the directive I get an error:
Multiple directives [ngController, dropZone (module: panda)] asking for new/isolated scope on: