2017-07-31 67 views
0

我試圖創建一個簡單的角度2號鍋爐此板Angular 2鍋爐板?

https://plnkr.co/edit/bT4mxVaUNnxfIm5t0zFQ?p=preview

有人能看到爲什麼它不工作

//our root app component 
import {Component, NgModule, VERSION} from '@angular/core' 

@Component({ 
    selector: 'my-app', 
    template: ` 
    <div> 
     <h2>Hello {{name}}</h2> 
    </div> 
    `, 
}) 
export class AppComponent { 
    name:string; 

    constructor() { 
    this.name = `Angular` 
    } 

} 
+1

我強烈建議使用Angular CLI來生成您的應用程序樣板。你可以在這裏找到︰https://github.com/angular/angular-cli – DeborahK

+0

@DeborahK,我不使用angular-cli進行探索,有太多你不需要 –

+0

我使用https:// github.com/AngularClass/angular-starter作爲我的Angular4x項目的鍋爐板,到目前爲止我很滿意。 – Rama

回答

1

它不工作,因爲你在src/main.ts進口environment

import { environment } from './environments/environment'; 

if (environment.production) { 
    enableProdMode(); 
} 

並且沒有environments/environment文件猛擊者。只需添加以下內容:

export const environment = { production: false }; 

src/environments/environment.ts,它會工作。

Here is工作的重擊者。