小编Wer*_*art的帖子

具有根级别导入的Angular2应用程序模块

根本级别的导入不应该全局可用(全局我指的是所有子模块和组件)?

我有以下root/app模块:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule, ApplicationRef } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import { HttpModule } from '@angular/http';
import { RouterModule } from '@angular/router';
import { appRouterProviders, routing } from './app.routes';
import { DashboardModule } from './dashboard/dashboard.module';
import { DecisionModule } from './decision/decision.module';
import { MdCoreModule }           from '@angular2-material/core';
import { MdButtonModule }         from '@angular2-material/button';
import { MdCardModule } …
Run Code Online (Sandbox Code Playgroud)

angular2-material angular

17
推荐指数
2
解决办法
1万
查看次数

Angular2 Http请求

嗨,我正在尝试使用HTTP模块进行获取请求Angular2.

所有内容都在Typescript(1.5)中编译良好,但Chrome在控制台中显示以下错误:

EXCEPTION: Error during instantiation of EntryList!. ORIGINAL
EXCEPTION: TypeError: Cannot read property 'merge' of undefined
ORIGINAL STACKTRACE: TypeError: Cannot read property 'merge' of undefined
at mergeOptions (angular2.dev.js:27991)  
at execute.Http.get (angular2.dev.js:28052)  
at EntryService.getEntries (services.js:17)
at new EntryList (entry-list.js:20)
Run Code Online (Sandbox Code Playgroud)

Services.ts

/// <reference path="../typings/angular2/angular2.d.ts" />
import { Http, Observable } from "angular2/angular2"

export class EntryService {
    private _entries: Array<string>;
    private _http : Http;

    constructor() {     
        this._entries = ["test1", "test2", "test3"];
        this._http = new …
Run Code Online (Sandbox Code Playgroud)

javascript typescript angular2-http angular

9
推荐指数
1
解决办法
1万
查看次数