我想做以下事情:
describe('Questions', () => {
var rest: RestService;
var mockBackend: MockBackend;
beforeEach((done) => {
console.log('Executing before each');
inject([RestService, XHRBackend], (_rest: RestService, _mockBackend: MockBackend) => {
rest = _rest;
mockBackend = _mockBackend;
console.log('This never gets executed');
done();
});
});
....
永远不会调用回调注入。我错过了什么,或者这是一个更复杂的解决方案吗?
答案 0 :(得分:0)
我想它应该只是
describe('Questions', () => {
var rest: RestService;
var mockBackend: MockBackend;
beforeEach(inject([RestService, XHRBackend], (_rest: RestService, _mockBackend: MockBackend) => {
rest = _rest;
mockBackend = _mockBackend;
console.log('This never gets executed');
});
});
取决于您的Angular2版本。