/angular-rpc

Primary LanguageJavaScriptMIT LicenseMIT

angular-rpc

Build Status

An RPC library for Angular.

Testing

The following command run unit & integration tests that are in the tests folder, and unit tests that are in src folder:

npm test

Building

The following command:

npm run build
  • starts TSLint with Codelyzer
  • starts AoT compilation using ngc compiler
  • creates dist folder with all the files of distribution

If you get errors during the building process or bundles are not created, set silent to false in the build.js file to check what's going wrong: warnings on the first execution of rollup are normal, and also the errors on tsc are a known issue.

To test locally the npm package:

npm run pack-lib

Then you can install it in an app to test it:

npm install [path]angular-rpc-[version].tgz

Publishing

Before publishing the first time:

npm run publish-lib

Documentation

To generate the documentation, this starter uses compodoc:

npm run compodoc
npm run compodoc-serve

Using the library

Installing

npm install angular-rpc --save

Loading

Using SystemJS configuration

System.config({
    map: {
        'angular-rpc': 'node_modules/angular-rpc/bundles/angular-rpc.umd.js'
    }
});

Angular-CLI

No need to set up anything, just import it in your code.

Rollup or webpack

No need to set up anything, just import it in your code.

Plain JavaScript

Include the umd bundle in your index.html:

<script src="node_modules/angular-rpc/bundles/angular-rpc.umd.js"></script>

and use global ng.rpcAngular namespace.

License

MIT