这是我的实际AzureService
cornerRadius
这是我的信息中心规范
declare var WindowsAzure;
declare var config;
@Injectable()
export class AzureService {
azureUrl;
client: any;
programmes: Programme[];
selectedProgramme: Programme;
orderSummary: Order;
constructor() {
this.client = new WindowsAzure.MobileServiceClient(this.azureUrl);}
}
仪表板组件承包商我正在注入天蓝色服务:
describe('DashboardComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
DashbaordComponent,
StatusComponent
],
providers:[ AzureService]
}).compileComponents();
}));
it('should create the app', async(() => {
const fixture = TestBed.createComponent(DashbaordComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
测试失败表明我没有定义WindowAzure,但我想在哪里定义?
这是错误:
答案 0 :(得分:0)
在模块级别声明变量
declare var WindowsAzure;
declare var config;
@NgModule({...})
这样它就可以在组件,服务之间共享。
还可以将它们导入到用作
的位置import { WindowsAzure } from '../azure.service.ts'