easy-core
Core Components For ng2
Last updated a year ago by juanlurie .
ISC · Original npm · Tarball · package.json
$ cnpm install easy-core 
SYNC missed versions from official npm registry.

Easy-Core for Angular

This is the home for Easy-Core. Built for Angular.

Boilerplate and core components abstraction to simplify application bootstrap.

Best used with npm:easy-suite

Installation

The latest release of Easy-Suite can be installed from npm

npm install --save easy-core

Project status

Easy Core is currently in beta and under active development. During beta, new features will be added regularly and APIs will evolve based on user feedback.

Feature status:

Feature Status
loader Available
http client Available
configurations Available

"Available" means that the components or feature is published and available for use, but may still be missing some behaviors or polish.

Getting started

Step 1: Install Easy Core

npm install --save easy-core

Step 2: Import the component modules

Import the NgModule:

import { HttpClient, httpServiceFactory, AppConfig, LoaderService, LoaderComponent } from 'easy-core';
import { LocalStorageModule, LocalStorageService } from 'angular-2-local-storage';
import { HttpModule, Http } from '@angular/http';

@NgModule({
  imports: [
   // ...
    HttpModule,
    LocalStorageModule.withConfig({
      prefix: '',
      storageType: 'localStorage'
    })
     // ...
  ],
  exports: [
   // ...
    LoaderComponent
   // ...
  ],
  declarations: [
   // ...
    LoaderComponent
   // ...
  ],
  providers: [
  // ...
    {
      provide: HttpClient,
      useFactory: httpServiceFactory,
      deps: [Http, LocalStorageService, LoaderService]
    },
    AppConfig,
    LoaderService,
    { provide: APP_INITIALIZER, useFactory: (config: AppConfig) => () => config.load(), deps: [AppConfig], multi: true }]
  // ...
})
export class AppModule { }

Step 3: Add/ Update Config File

Add a config folder app route.

Add env.json file.

{
    "env": "development"
}

Add config.development.json file.

[{
    "Name": "itemUrl",
    "Value": "http://google.com/"
  }
]

Step 4: Httpclient Usage


import { Injectable } from '@angular/core';
import { AppConfig, HttpClient } from 'easy-core';

@Component({
  selector: 'hello-world',
  template: '<easy-form [form]="form"></easy-form>'
})

@Injectable()
export class HelloWorldService {

  form: EasyForm;
  config: AppConfig;

    constructor(config: AppConfig, private httpClient: HttpClient) {
        this.config = config;
    }

   getItems() {
        let url = this.config.get('itemUrl') + 'TestRoute';
        return this.httpClient.get(url);
    }

}

Step 4: Loader Usage

In main app.html add loading component

<angular-loader></angular-loader>

Extension Methods

Array Extensions

In your root module import the ArrayExtensions module. In the root module of your secondary application do the same.

import { ArrayExtensions } from 'easy-core'; 
        single(func: (value: T) => void): T;
        singleOrDefault(func: (value: T) => void): T;
        first(func: (value: T) => void): T;
        first(): T;
        firstOrDefault(func: (value: T) => void): T;
        firstOrDefault(): T;
        where(func: (value: T) => void): T[];
        any(func: (value: T) => void): boolean;
        all(func: (value: T) => void): boolean;
        orderBy(propertyExpression: (item: T) => any): T[];
        orderByDescending(propertyExpression: (item: T) => any): T[];
        add(item: T): void;
        addRange(items: T[]): void;
        remove(item: T): boolean;

Example


let items = new Array<string>();
items.add("hello");
items.add("world");

alert(items.first()); //This will print "hello".
alert(items.firstOrDefault(x=>x == "world");); //This will print "world".

String Extensions

In your root module import the StringExtensions module. In the root module of your secondary application do the same.

import { StringExtensions } from 'easy-core'; 
  fromCamelCase(): string;

Example


let text = "HelloWorld";
alert(text.fromCamelCase()); //prints "Hello World";

Appendix: Configuring SystemJS

If your project is using SystemJS for module loading, you will need to add easy-suite to the SystemJS configuration:

System.config({
  // existing configuration options
  map: {
    // ...
    'easy-suite': 'npm:easy-suite/src/',
    'easy-core': 'npm:easy-core/src/'
    // ...
  },

  packages: {
    // ...
      'easy-core': {
        main: 'index.js',
        defaultExtension: 'js'
      },
      'easy-suite': {
        main: 'index.js',
        defaultExtension: 'js'
      }
    // ...
    }

});

Current Tags

  • 0.53.45                                ...           beta (a year ago)
  • 0.53.51                                ...           latest (a year ago)

105 Versions

  • 0.53.51                                ...           a year ago
  • 0.53.50                                ...           a year ago
  • 0.53.49                                ...           a year ago
  • 0.53.48                                ...           a year ago
  • 0.53.47                                ...           a year ago
  • 0.53.46                                ...           a year ago
  • 0.53.45                                ...           a year ago
  • 0.53.40                                ...           2 years ago
  • 0.53.39                                ...           2 years ago
  • 0.53.38                                ...           2 years ago
  • 0.53.37                                ...           2 years ago
  • 0.53.36                                ...           2 years ago
  • 0.53.35                                ...           2 years ago
  • 0.55.3                                ...           2 years ago
  • 0.55.2                                ...           2 years ago
  • 0.55.1                                ...           2 years ago
  • 0.53.34                                ...           2 years ago
  • 0.53.33                                ...           2 years ago
  • 0.53.32                                ...           2 years ago
  • 0.53.31                                ...           2 years ago
  • 0.53.30                                ...           2 years ago
  • 0.53.29                                ...           2 years ago
  • 0.53.28                                ...           2 years ago
  • 0.53.27                                ...           2 years ago
  • 0.53.26                                ...           2 years ago
  • 0.53.25                                ...           2 years ago
  • 0.53.24                                ...           2 years ago
  • 0.53.23                                ...           2 years ago
  • 0.53.22                                ...           2 years ago
  • 0.53.21                                ...           2 years ago
  • 0.53.20                                ...           2 years ago
  • 0.53.19                                ...           2 years ago
  • 0.53.18                                ...           2 years ago
  • 0.53.17                                ...           2 years ago
  • 0.53.16                                ...           2 years ago
  • 0.53.15                                ...           2 years ago
  • 0.53.14                                ...           2 years ago
  • 0.53.13                                ...           2 years ago
  • 0.53.12                                ...           2 years ago
  • 0.53.11                                ...           2 years ago
  • 0.53.10                                ...           2 years ago
  • 0.53.9                                ...           2 years ago
  • 0.53.8                                ...           2 years ago
  • 0.53.7                                ...           2 years ago
  • 0.51.3                                ...           2 years ago
  • 0.51.2                                ...           2 years ago
  • 0.51.1                                ...           2 years ago
  • 0.50.26                                ...           2 years ago
  • 0.50.25                                ...           2 years ago
  • 0.50.21                                ...           2 years ago
  • 0.50.50                                ...           2 years ago
  • 0.50.40                                ...           2 years ago
  • 0.50.30                                ...           2 years ago
  • 0.50.20                                ...           2 years ago
  • 0.50.17                                ...           2 years ago
  • 0.50.16                                ...           2 years ago
  • 0.50.15                                ...           2 years ago
  • 0.50.14                                ...           2 years ago
  • 0.50.12                                ...           2 years ago
  • 0.50.11                                ...           2 years ago
  • 0.50.10                                ...           2 years ago
  • 0.50.6                                ...           2 years ago
  • 0.50.5                                ...           2 years ago
  • 0.50.4                                ...           2 years ago
  • 0.50.3                                ...           2 years ago
  • 0.50.2                                ...           2 years ago
  • 0.50.1                                ...           2 years ago
  • 0.20.1                                ...           2 years ago
  • 0.3.14                                ...           2 years ago
  • 0.5.1                                ...           2 years ago
  • 0.3.16                                ...           2 years ago
  • 0.3.15                                ...           2 years ago
  • 0.3.13                                ...           2 years ago
  • 0.3.12                                ...           2 years ago
  • 0.3.11                                ...           2 years ago
  • 0.3.10                                ...           2 years ago
  • 0.3.9                                ...           2 years ago
  • 0.3.8                                ...           2 years ago
  • 0.3.7                                ...           2 years ago
  • 0.3.6                                ...           2 years ago
  • 0.3.5                                ...           2 years ago
  • 0.3.4                                ...           2 years ago
  • 0.3.3                                ...           2 years ago
  • 0.3.2                                ...           2 years ago
  • 0.3.1                                ...           2 years ago
  • 0.2.3                                ...           2 years ago
  • 0.2.2                                ...           2 years ago
  • 0.2.1                                ...           2 years ago
  • 0.1.17                                ...           2 years ago
  • 0.1.16                                ...           2 years ago
  • 0.1.15                                ...           2 years ago
  • 0.1.14                                ...           2 years ago
  • 0.1.13                                ...           2 years ago
  • 0.1.12                                ...           2 years ago
  • 0.1.10                                ...           2 years ago
  • 0.1.9                                ...           2 years ago
  • 0.1.8                                ...           2 years ago
  • 0.1.7                                ...           2 years ago
  • 0.1.6                                ...           2 years ago
  • 0.1.5                                ...           2 years ago
  • 0.1.4                                ...           2 years ago
  • 0.1.3                                ...           2 years ago
  • 0.1.2                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
Downloads
Today 0
This Week 0
This Month 105
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (29)

Copyright 2014 - 2016 © taobao.org |