Errors during minifying


#1

I’m going through the painful process of minifying my code and came across this error.

Error: [$injector:unpr] Unknown provider: dProvider <- d

Its coming from a side menu where I’m providing a controller inline to just the left side menu.

<ion-side-menu side="left" ng-controller="ListCtrl">

  <div class="bar bar-header bar-dark">

    <a class="button button-clear button-full title dark-head" ui-sref="home">

      Main Menu

    </a>

  </div>

  <ion-content class="has-header" has-bouncing="true">

    <div class="list">

      <a ng-repeat="pet in pets" class="item" ui-sref="main.detail({petsId: pet.id })" ui-sref-active="active" menu-toggle="left">

        <p>{{pet.title}}</p>

      </a>

    </div>

  </ion-content>

</ion-side-menu>

And the controller is a modified version of the seed app’s controller

.controller('IndexCtrl', [ 'PetService', '$scope',function (PetService, $scope) {
   
    // 'Pets' is a service returning mock data (services.js)
    'use strict';
    $scope.pets = PetService.all();

  }]);

And this controller is being used by two views, one as a list to display the items, and the second is the side menu described above. Is my code properly annotated somehow? Any ideas on why I’m getting this error?


#2

This is an old bug in ui-router 0.2.7. ui-sref-active is making this.
See this conversation: https://github.com/driftyco/ionic/pull/941

Until that pull request is accepted, you can solve this by
a. update to latest ui-router (recommended…)
b. don’t use ui-sref-active. Use another way, for example, ng-class="{active:$state.includes('schedule')}"