Angularjs - $rootScope in directive link function
问题 I am asking this question because I am not quite clear on how to think of rootscope as a dependency passed to directives I have a directive that needs to display some information from $rootScope ... I thought I needed to pass the $rootScope to a directive but when I write a directive like this it seems to work. .directive("myBar", function () { return { restrict: "E", transclude: true, replace: true, template: '<div>' + '<span ng-transclude></span>' + '{{rsLabels.welcome}} {{rsUser.firstName}