Make sure the template map is configured properly in your module.config.php. In this example the template has the configs for both modules, however you could also have a module.config.php for each module if you so desired, with its template_map pertaining only to the controllers within that specific module.
'view_manager' => array(
'display_not_found_reason' => true,
'display_exceptions' => true,
'doctype' => 'HTML5',
'not_found_template' => 'error/404',
'exception_template' => 'error/index',
'template_map' => array(
'Login/some_controller/index' => __DIR__ . '/path/to/view/file',
'Home/some_controller/index' => __DIR__ . '/path/to/view/file'
'template_path_stack' => array(
__DIR__ . '/../view',
),
)
Now your controller invokables
'controllers' => array(
'invokables' => array(
'Home\Controller\Index' => 'Home\Controller\IndexController',
'Login\Controller\Ajax' => 'Application\Controller\AjaxController',
)
)