These are chat archives for AngularClass/angular2-webpack-starter

27th
Sep 2016
Mark Pritchett
@markpritchett
Sep 27 2016 07:30

Just found: https://github.com/AngularClass/angular2-webpack-starter/wiki/How-to-pass-environment-variables%3F which is useful but it breaks the unit tests.

My component looks like:

@Component({
  selector: 'app',
  encapsulation: ViewEncapsulation.None,
  styleUrls: [
    './app.style.css'
  ],
  templateUrl: './app.component.html'
})
export class App {
  angularclassLogo = 'assets/img/angularclass-avatar.png';
  name = 'Angular 2 Webpack Starter';
  url = 'https://twitter.com/AngularClass';
  apiUrl = API_URL;
  constructor(
    public appState: AppState) {

  }

  ngOnInit() {
    console.log('Initial App State', this.appState.state);
  }

}

I get a ReferenceError: API_URL is not defined error. Any ideas on how to use global variables that were defined using DefinePlugin in components?

Jonas Möller
@j-moeller
Sep 27 2016 12:05

Hello,
I'm migrating to angular2-webpack-starter, but got the following error upon start:

/angular2-webpack-starter/node_modules/angular2-component-outlet/src/provider.d.ts:21:64 Cannot find name 'NgModule'. [default] Checking finished with 1 errors

angular2-component-outlet is a dependency I added via npm install - do I need to edit a config file somehow?