I'm trying to pass my controller into another controller and i keep getting an Error: [$injector:unpr] Unknown provider: MchControllerProvider <- MchController
How do i properly inject one controller into another? Here is my code:
This section is the GroupMaintenanceBrowsePlansCtrl->
(function () {
'use strict';
var controllerId = 'GroupMaintenanceBrowsePlansCtrl';
angular.module('myApp').controller(controllerId, ['$scope', 'RenewalGroupDataService', 'logger', 'mchService', 'MchController' , Controller]);
function Controller($scope, datacontext, logger,mchService, MchController) {
logger = logger.forSource(controllerId);
....
This section is the MchController ->
'use strict';
myApp.controller('MchController', function ($scope, $routeParams, mchService, CustomerDataService, EntityInfoService, RatesDataService, RenewalGroupDataService) {
console.log('reached MchController');
//Rout parameters as passed via App.js
$scope.routeParams = {
type: $routeParams.Type,
id: $routeParams.Id
};
//Properties associated with data
$scope.visible = {
experience: true,
persistency: true,
}
// define view model and expose it to the scope
var vm = {
title: 'Loading MCH Name... ',
CustomerNumber: 'Loading MCH Number...'
};
$scope.vm = vm; //local scope to MchController
vm.type = $routeParams.Type;
vm.id = $routeParams.Id;
vm.togglePlans = togglePlans;
vm.toggleRates = toggleRates;
vm.getRateInformation = getRateInformation;
vm.getMch6 = getMch6;
vm.Mch2Information = [];
vm.searchParameters = mchService.searchParameters;
function togglePlans()
{
vm.expandedPlans = !vm.expandedPlans;
}
//Puts multiple sets of Mch2 data into array to iterate through
vm.Mch2Information = new Array();
vm.getEntityInformation = function () {
getEntityInformation('MCH', mchService.searchParameters);
}
//Initialize GET command for Customer Information
//getEntityInformation($routeParams.Type, $routeParams.Id);
function getEntityInformation(type, id)
{
switch (type)
{
case "MCH": getCustomerInformation(id);
//getMch6();
getMch2Information(id);
....