ngProgress icon indicating copy to clipboard operation
ngProgress copied to clipboard

Template should be customisable

Open jamesjwarren opened this issue 10 years ago • 3 comments

It would be nice to be able to provide an alternative template for the loading directive.

jamesjwarren avatar Jan 12 '16 14:01 jamesjwarren

Hi @jamesjwarren can you submit a PR for this

cetra3 avatar Feb 09 '16 23:02 cetra3

Could you just change the template setting to templateUrl in the directive part? Then it would be easy to override the default template and implement custom once.

I guess this change is too small for a PR but would help many people! :-)

https://github.com/VictorBjelkholm/ngProgress/blob/master/src/directive.js#L35 template: '<div id="ngProgress-container"><div id="ngProgress"></div></div>' to templateUrl:'ngProgress/template.html'

BioPhoton avatar Feb 20 '16 15:02 BioPhoton

I would say it should be configurable per instance, rather than a hardset value. Then when changing the instance config, you have a chance to change it.

Otherwise, you can use the provide decorator to do what you asked:

angular.module('myModule', ['ngProgress'])
  .config(['$provide', function($provide) {
    $provide.decorator('ngProgressDirective', function($delegate) {
      var directive = $delegate[0];
      directive.template = '<div id="ngProgress-container"><div id="ngProgress"></div></div>';
      return $delegate;
    });
   }
]);

cetra3 avatar Feb 21 '16 06:02 cetra3