1.4.0 • Published 6 years ago

nx-toolkit v1.4.0

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

nx-toolkit

Collection of Helper functions and other Utilities to speed up angular development,

Install

Create a new angular project and install nx-toolkit via npm install nx-toolkit

Features

Decorators

NxBaseFunctions

Decorator adds most of the code required to get started with the angular component. Basic functionality such as creating a dataLoader function, assigning query parameters from route (eg. search) to queryParams #####Usage

 @Component({
     selector: 'hr-banks',
     templateUrl: './banks.component.html',
     styleUrls: ['./banks.component.styl']
 })
 @NxBaseFunctions({
     serviceName: 'bankService'
 })
 export class BanksComponent implements OnInit {
    constructor(private bankService: BankService,
                private activatedRoute: ActivatedRoute)
 }

This adds the following methods and to the component.

export interface BaseFunctionT {
   nxDataSource: NxDataSource | null;
   dataSubject: BehaviorSubject<any[]>;
   queryParams: Params | null;
   
   loadData(params?: object): void;
   getUpdatedRouteParams(newParams: object): Params;
}

NxDataService

Decorator adds basic crud functions to the angular service (@Injectable)

Usage
@Injectable()
@NxDataService({
    url: '/api/banks'
})
export class BankService {
    constructor(private http: HttpClient) {
    }
}

This adds the following methods to the service

export interface NxDataService<T> {
    list(params?: object): Observable<any>;

    get(id: number): Observable<T>;

    add(T): Observable<any>;

    update(T): Observable<any>;

    delete(number): Observable<any>;
}

Dev Instructions

git clone https://github.com/ashamnx/nx-toolkit.git
cd nx-toolkit
npm link
// then in your angular project do
npm link nx-toolkit
// now nx-toolkit will be available in your project (via node_modules)
// any changes made to original nx-toolkit will be reflected in your project.
// create PR if you wish to push to your changes
1.4.0

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago