AngularJS use constant in directive -
i have defined constant this:
app.constant('ngsettings', { apibaseurl: 'https://url/' });
how can reference constant in directive?
where directive this:
angular.module('my.directive', []).directive(...................
you can inject constant anywhere injectable including directive definition itself, controller of directive, link function, et. al.
angular.module('my.directive', []).directive('name', ['ngsettings', function (ngsettings) { // things ngsettings return {}; }]);
by way wouldn't name define ng
-- should preserved things in ng
module or angular created.