1.0.0 • Published 8 years ago

sails-generate-angular2 v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

sails-generate-angular2

Typescript + Angular2 Sails.js generator

Installation

In order to use a generator you will need the latest Sails, ~0.10, which can be installed with:

npm install sails -g

Once that's all set, install the generator:

$ npm install sails-generate-angular2

Production Usage

On the command line
$ sails generate angular2
Install Angular2 and needed libs:
$ cd assets
$ npm install
Modify tasks/config/copy.js file:
...
src: [
          '**/*.!(coffee|less|ts)',
          '!package.json',
          '!node_modules/**',
          'node_modules/es6-shim/**',
          'node_modules/systemjs/**',
          'node_modules/angular2/**',
          'node_modules/systemjs/**',
          'node_modules/rxjs/**',
          'node_modules/angular2/**'
        ],
...
Add dependencies to layout.ejs (or wherever you want :-)):
    <script src="/node_modules/es6-shim/es6-shim.min.js"></script>
    <script src="/node_modules/systemjs/dist/system-polyfills.js"></script>

    <script src="/node_modules/angular2/bundles/angular2-polyfills.js"></script>
    <script src="/node_modules/systemjs/dist/system.src.js"></script>
    <script src="/node_modules/rxjs/bundles/Rx.js"></script>
    <script src="/node_modules/angular2/bundles/angular2.dev.js"></script>

    <script>
        System.config({
            map: {
                rxjs: '/node_modules/rxjs' // added this map section
            },
            packages: {
                app: {
                    format: 'register',
                    defaultExtension: 'js'
                },
                'rxjs': {defaultExtension: 'js'} // and added this to packages
            }
        });
        System.import('/app/main')
                .then(null, console.error.bind(console));
    </script>
Usage
  <my-app></my-app>
Problems

Angular2 is still beta.


Copyright © 2016 Adam Sawicki. Licensed under the terms of the MIT license.