@initial/angular-library v0.1.15
INITIAL Angular Components
Table of contents
About
Incubateur de projets NumérIque du minisTère de l'Agriculture et de l'aLimentation
Demo
Coming soon...
Installation
Install through npm:
npm install --save @initial/angular-library
Usage
Module imports
//demo.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { SelectModule } from '@initial/angular-library';
import { Demo } from './demo.component';
@NgModule({
declarations: [Demo],
imports: [
BrowserModule,
SelectModule
],
bootstrap: [Demo]
})
export class DemoModule {}
Select component
This component creates a selectbox with search capabilities
//demo.component.ts
import {Component} from '@angular/core';
@Component({
selector: 'demo-app',
template: `<initial-select [(ngModel)]="selectedCulture" name="culture"
[items]="cultures" bindLabel="libelle" placeholder="Select a culture">
</initial-select>`
})
export class Demo {
cultures = [{
'idMetier': '1001',
'libelle': 'Abricocotier',
}, {
'idMetier': '1002',
'libelle': 'Ail',
}, {
'idMetier': '1003',
'libelle': 'Airelle',
}, {
'idMetier': '1004',
'libelle': 'Amandier',
}, {
'idMetier': '1005',
'libelle': 'Ananas',
}, {
'idMetier': '1006',
'libelle': 'Arachide',
}, {
'idMetier': '1007',
'libelle': 'Arbres et arbustes',
}];
selectedCulture;
}
Development
Development server
Run npm run start
for a dev server. Navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
Running unit tests
Run npm run test
to execute the unit tests via Karma.
Running end-to-end tests
Run npm run e2e
to execute the end-to-end tests via Protractor.
Before running the tests make sure you are serving the app via ng serve
.
Build
Run npm run build
to build the project. The build artifacts will be stored in the dist/
directory.
Package
Run npm run package
to package the project.
The project can then be installed with npm install <relative_dir>/dist/initial-angular-library-<version>.tgz
Release
- Bump the version in package.json
- Commit and push to github
- Login to your npm account with
npm login
- Publish to npm repository with
npm run release
License
MIT