https://github.com/kaiu-lab/ng-serializer
Angular module wrapping @kaiu/serializer
https://github.com/kaiu-lab/ng-serializer
angular serializer
Last synced: 4 months ago
JSON representation
Angular module wrapping @kaiu/serializer
- Host: GitHub
- URL: https://github.com/kaiu-lab/ng-serializer
- Owner: kaiu-lab
- Created: 2017-07-13T14:42:06.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-02-23T19:45:17.000Z (over 3 years ago)
- Last Synced: 2025-08-20T09:59:12.028Z (10 months ago)
- Topics: angular, serializer
- Language: TypeScript
- Size: 482 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# ng serializer
[](https://travis-ci.org/kaiu-lab/ng-serializer)
[](https://codecov.io/gh/kaiu-lab/ng-serializer)
[](https://www.npmjs.com/package/@kaiu/ng-serializer)
[](https://david-dm.org/kaiu-lab/ng-serializer?type=dev)
[](https://github.com/kaiu-lab/ng-serializer/issues)
[](https://github.com/kaiu-lab/ng-serializer/stargazers)
[](https://raw.githubusercontent.com/kaiu-lab/ng-serializer/master/LICENSE)
## Table of contents
- [About](#about)
- [Installation](#installation)
- [Documentation](#documentation)
- [Development](#development)
- [License](#license)
## About
Angular wrapper for [@kaiu/serializer](https://www.npmjs.com/package/@kaiu/serializer) library
## Installation
Install through npm:
```
npm install --save @kaiu/ng-serializer @kaiu/serializer
```
Then include in your apps module:
```typescript
import { NgModule } from '@angular/core';
import { NgSerializerModule } from 'ng-serializer';
@NgModule({
imports: [
NgSerializerModule.forRoot()
]
})
export class MyModule {}
```
Finally use in one of your apps components:
```typescript
import { Component, OnInit } from '@angular/core';
import { Http } from '@angular/http';
import { Foo } from './models/foo';
import { NgSerializerService } from '@kaiu/ng-serializer';
@Component({
template: 'foo'
})
export class MyComponent implements OnInit {
constructor(private http:Http, private serializerService:NgSerializerService){}
ngOnInit():void{
let data = this.http.get('https://foo.org/bar').map(response => {
return this.serializerService.deserialize(response.json(), Foo);
});
data.subscribe(fooModel => {
fooModel.baz();//This will work !
});
}
}
```
The full documentation of the serializer can be found on [@kaiu/serializer's website](https://kaiu-lab.github.io/serializer/).
### Usage without a module bundler
```
// everything is exported ngSerializer namespace
```
## Development
### Prepare your environment
* Install [Node.js](http://nodejs.org/) and NPM
* Install local dev dependencies: `yarn install` while current directory is this repo
### Testing
Run `yarn test` to run tests once or `yarn test:watch` to continually run tests.
### Release
* Bump the version in package.json (once the module hits 1.0 this will become automatic)
```bash
yarn release
```
## License
MIT