angular js getting error using $stateParams

136 Views Asked by At

My app is working correctly, but AS SOON AS I add $stateParams in the controller I'm get this error:

angular.js:14791 Error: [$injector:unpr] Unknown provider: $stateParamsProvider <- $stateParams <- ClienteViniCtrl

This is from: app.js

     .when('/clienti/:id_cliente', {
    templateUrl: 'views/cliente-vini.html',
    controller: 'ClienteViniCtrl'
  })

This is from: controller.js

  .controller('ClienteViniCtrl', function($scope, $stateParams, Vini){
  Vini.getWines($stateParams.id_cliente).then(function (result) {
      $scope.vini = result;
  })

What's the problem?

1

There are 1 best solutions below

1
Guy Yogev On

Do you have added angular-ui-router.js at your project?

var myApp = angular.module('myApp', ['ui.router']);