I'm trying to instantiate an object using the angular.factory recipe. The factory code is something like this
monevAppServices.factory('MonEvChartService', ['element','chartConfig',function monEvChartFactory(element,chartConfig) {
return MonEvChart;
}
where element and chartconfig are arguments expected by the MonEvChart, something like
new MonEvChart(element,chartConfig);
However when I try to use this service in my controller (after injecting it)
angular.module('monevApp.controllers', [])
.controller('NewDashboard',
['$rootScope','$scope','subscribedMonitor','MonEvChartService','$log',
function($rootScope,$scope,subscribedMonitor,MonEvChartService,$log) {
...
$scope.monevchart = new MonEvChartService($scope.element,$scope.chartConfig);
...
It throws an error like
Error: [$injector:unpr] Unknown provider: elementProvider - element - MonEvChartService
http://errors.angularjs.org/1.2.15/$injector/unpr?p0=elementProvider%20%3C-%20element%20%3C-%20MonEvChartService
at http://localhost:9000/bower_components/angular/angular.js:78:12
Any help guidance would be really appreciated. Thanks!