Your example of your directive is very simple, so I donβt see what you want to achieve. At least I can say: you can define new functions as scope functions, for example.
... link: function(scope, element, attrs) { scope.reset = function() {
If you want to access the downloaded data (for example, for use in the reload () function) in a scope, you must write a controller for this use. therefore, you can enter the service as a data source. Embedding functions directly related to elements is more likely a jQuery way to make it non-angular. In angularjs, you work mainly with areas.
You might provide a more complete example at best with jsfiddle or plnkr, I think itβs easier for you to help see your use case or your problem as part of the working code.
source share