ttmt
ttmt

Reputation: 4984

Angular 2 boiler plate?

I'm trying to create a simple Angular 2 boiler plate here

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

Can anyone see why its not working

//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`
  }

}

Upvotes: 0

Views: 151

Answers (1)

Max Koretskyi
Max Koretskyi

Reputation: 105497

It's not working because you imported environment in the src/main.ts:

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

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

and there's no environments/environment file in the plunker. Just add the following:

export const environment = { production: false };

to the src/environments/environment.ts and it will work.

Here is the working plunker.

Upvotes: 1

Related Questions