angularjs - Inject constant into link function along with parent controller -
i'm using following syntax inject parent controller custom directive's link function , i'd inject constant well. angular.module('mymodule') .constant('mydefaults', { key: value }) .directive('mydirective', function () { return { require:'^myparentdirective', restrict: 'ea', scope: {}, link: function ($scope, $element, $attrs, myparentdirectivectrl, mydefaults) { ... link funciton code ... } } } unfortunately, mydefaults not defined , if swap order myparentdirectivectrl undefined. i thought order didn't matter, presumably because think can call parent controller when inject it, doesn't need called same name in actual parent directive's controller. so, have 4th parameter of link function? , why ignoring injected after it? thanks. if want inject service , factory or controller should directive not link.inject dependancies directive, work f