Skip to content

Using Angular CLI

Thomas Burleson edited this page Oct 21, 2017 · 10 revisions

Using Flex-Layout with the the Angular CLI is easy.

Install the CLI

# Global
npm uninstall -g @angular/cli
npm install -g @angular/cli

Create a new project

 ng new my-project

Or, use with existing project

rm -rf node_modules/
npm install

The new command creates a project with a build system for your Angular app.

Install Flex-Layout

npm install @angular/flex-layout --save

This ^ installs the most recent npm release of Flex-Layout.

npm install https://github.com/angular/flex-layout-builds --save

This installs a nightly build which provides supports for the current Angular 4.0, AOT, Universal, and CLI 1.3.0.

Import the Angular Flex-Layout NgModule

src/app/app.module.ts

import { FlexLayoutModule } from '@angular/flex-layout';
// other imports 
@NgModule({
  imports: [FlexLayoutModule],
  ...
})
export class PizzaPartyAppModule { }

Configuring SystemJS

If your project is using SystemJS for module loading, you will need to add @angular/flex-layout to the SystemJS configuration:

System.config({
  // existing configuration options
  map: {
    ...,
    '@angular/flex-layout': 'npm:@angular/flex-layout-builds/bundles/flex-layout.umd.js'
  }
});

Sample Angular 2 Flex-Layout projects

Developers are encouraged to review the live demos and source for the Flex-Layout Demos:

Clone this wiki locally