Skip to content

Commit dc335f3

Browse files
author
Mattia Dal Ben
committed
Using $injector to support optional ui.router’s service dependency
1 parent 8b0c5aa commit dc335f3

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/navigation/vertical-navigation-directive.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,9 +565,16 @@
565565
</file>
566566
</example>
567567
*/
568-
angular.module('patternfly.navigation').directive('pfVerticalNavigation', ['$location', '$rootScope', '$window', '$document', '$timeout', '$state',
569-
function (location, rootScope, $window, $document, $timeout, $state) {
568+
angular.module('patternfly.navigation').directive('pfVerticalNavigation', ['$location', '$rootScope', '$window', '$document', '$timeout', '$injector',
569+
function (location, rootScope, $window, $document, $timeout, $injector) {
570570
'use strict';
571+
var $state;
572+
573+
// Optional dependency on $state
574+
if ($injector.has("$state")) {
575+
$state = $injector.get("$state");
576+
}
577+
571578
return {
572579
restrict: 'A',
573580
scope: {

0 commit comments

Comments
 (0)