1.2.0 • Published 8 years ago

co-request-manager v1.2.0

Weekly downloads
3
License
ISC
Repository
github
Last release
8 years ago

co-request-manager

Angular 2 REST Request manager

Install

  • npm install --save co-request-form co-browser-storage co-list-view-table co-request-manager
  • Also need @ngrx/store to work
  • Set up co-browser-storage first and add a browser storage param for this app
  • main.ts:
import {provideCoRequestManager} from '../request-manager/co-request-manager.provider'

bootstrap(MyApp, [
  // NOTE it's the key without the co-browser-storage namespace here
  provideCoRequestManager('requestManagerConfigBrowserStorageKey')
])
  • co-browser-storage.config:
export const REQUEST_MANAGER_CONFIG = 'requestManagerConfig'
...
{
  key: REQUEST_MANAGER_CONFIG,
  value: '{"requests":[]}',
  storageType: 'localStorage',
  valueType: 'text'
}
...
  • some.component.ts:

Note that listHeight is optional

import {Component, ViewChild} from '@angular/core'

import {CoRequestManagerComponent} from 'co-request-manager/co-request-manager'

@Component({
  selector: 'app',
  directives: [CoRequestManagerComponent],
  template: `
    <co-request-manager
      [listHeight]="'300px'">
      <button type="button" class="btn btn-success btn-block" (click)="makeRequest()">
        Make request
      </button>
    </co-request-manager>
  `
})
export class AppComponent {
  @ViewChild(CoRequestManagerComponent) coRequestManagerComponent: CoRequestManagerComponent

  public makeRequest () {
    let params = this.coRequestManagerComponent.coRequestFormComponent.request()
    console.log(params)
  }
}

Develop

  • npm install
  • npm run typings
  • npm run watch
  • npm start
  • Open browser and navigate to localhost:3000
1.2.0

8 years ago

1.1.0

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago