Getting Unknown Provider error when injecting a Service into an Angular unit test

后端 未结 4 1602
难免孤独
难免孤独 2021-02-06 23:01

I\'m fairly new to Angular and have reviewed all the similarly related questions on Stack Overflow but none have helped me. I believe I have everything set up correctly but am s

4条回答
  •  一向
    一向 (楼主)
    2021-02-06 23:30

    If your controllers (defined under dashboard.controllers module) depend on some services which are enclosed in different module (dashboard.services) than you need to reference the dependency modules in your module signature:

    angular.module('dashboard.services', []);
    angular.module('dashboard.controllers', ['dashboard.services']);
    

提交回复
热议问题