1

I'm using the ngClip plugin to attempt to add a "copy to clipboard" option to my web app. I am also using the ui-router in my module config. The problem is that when I add the ngClipProvider dependency to my .config, the $urlRouterProvider becomes undefined. When I remove it, $urlRouterProvider is an object again. Below is my code:

var app = angular.module('app',['ui.router', 'ui.date', 'ngAnimate', 'angular-loading-bar', 'orders-directives', 'orders-controllers', 'orders-services', 'orders-factories', 'ngClipboard']);
//Config
app.config(['ngClipProvider', function($stateProvider, $urlRouterProvider, ngClipProvider){
    $urlRouterProvider.otherwise('/');
    $stateProvider.state('/', {
        url: '/',
        templateUrl: 'templates/admin-view.html',
        controller: 'ordersController as ordersCtrl'
    }).state('order', {
        url: '/order/:ordernum?id',
        templateUrl: 'templates/order-details.html',
        controller: 'orderDetailsController as orderCtrl'
    }).state('export', {
        url: '/export',
        templateUrl: 'templates/review-export.html',
        controller: 'reviewExportController as reviewExportCtrl'
    });
    //ngClipProvider.setPath("../plugins/ZeroClipboard/ZeroClipboard.swf");
}]);

If I remove the "['ngClipProvider .....]" section and the "ngClipProvider" from the function parameters, everything works. As is above, $urlRouterProvider is null.

shruti1810
  • 3,920
  • 2
  • 16
  • 28

1 Answers1

1

You are messing with inline dependency injection array , missed to add '$stateProvider', '$urlRouterProvider' before 'ngClipProvider'

app.config(['$stateProvider', '$urlRouterProvider', 'ngClipProvider', 
     function($stateProvider, $urlRouterProvider, ngClipProvider){
     //code here...
}])
Pankaj Parkar
  • 134,766
  • 23
  • 234
  • 299