Skip to content

Commit

Permalink
Upgrade to angular@^2.0.0. Close #27
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuszfoltak committed Oct 9, 2016
1 parent 3a5eaa0 commit bf13b87
Show file tree
Hide file tree
Showing 17 changed files with 189 additions and 134 deletions.
2 changes: 1 addition & 1 deletion examples/systemjs/index.html
Expand Up @@ -9,7 +9,7 @@

<!-- 1. Load libraries -->
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/es6-shim/es6-shim.min.js"></script>
<script src="node_modules/core-js/client/shim.min.js"></script>

<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/reflect-metadata/Reflect.js"></script>
Expand Down
32 changes: 18 additions & 14 deletions examples/systemjs/package.json
Expand Up @@ -19,19 +19,23 @@
"tsd": "^0.6.5"
},
"dependencies": {
"@angular/common": "^2.0.0-rc.1",
"@angular/compiler": "^2.0.0-rc.1",
"@angular/core": "2.0.0-rc.1",
"@angular/http": "2.0.0-rc.1",
"@angular/platform-browser": "^2.0.0-rc.1",
"@angular/platform-browser-dynamic": "^2.0.0-rc.1",
"angular2-datatable": "0.4.0",
"bootstrap": "^3.3.6",
"es6-shim": "^0.35.0",
"lodash": "^4.6.1",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.6",
"systemjs": "^0.19.9",
"zone.js": "0.6.12"
"@angular/common": "~2.0.0",
"@angular/compiler": "~2.0.0",
"@angular/core": "~2.0.0",
"@angular/forms": "~2.0.0",
"@angular/http": "~2.0.0",
"@angular/platform-browser": "~2.0.0",
"@angular/platform-browser-dynamic": "~2.0.0",
"@angular/upgrade": "~2.0.0",

"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.8",
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.39",
"zone.js": "^0.6.25",

"angular2-datatable": "0.5.0-dev.4",
"lodash": "^4.6.1"
}
}
Expand Up @@ -17,7 +17,7 @@ <h2>Simple data table</h2>
<thead>
<tr>
<th style="width: 20%">
<mfDefaultSorter [by]="sortByWordLength">Name</mfDefaultSorter>
<mfDefaultSorter by="name">Name</mfDefaultSorter>
</th>
<th style="width: 50%">
<mfDefaultSorter by="email">Email</mfDefaultSorter>
Expand Down
30 changes: 30 additions & 0 deletions examples/systemjs/src/AppComponent.ts
@@ -0,0 +1,30 @@
import {Component} from "@angular/core";
import {Http} from "@angular/http";


@Component({
selector: 'app',
templateUrl: 'src/AppComponent.html'
})
export class AppComponent {

public data;

constructor(private http:Http) {
http.get("/src/data.json")
.subscribe((data)=> {
setTimeout(()=> {
this.data = data.json();
}, 2000);
});
}

public toInt(num:string) {
return +num;
}

public sortByWordLength = (a:any) => {
return a.name.length;
}

}
18 changes: 18 additions & 0 deletions examples/systemjs/src/AppModule.ts
@@ -0,0 +1,18 @@
import {NgModule} from "@angular/core";
import {AppComponent} from "./AppComponent";
import {BrowserModule} from "@angular/platform-browser";
import {DataTableModule} from "angular2-datatable";
import {HttpModule} from "@angular/http";

@NgModule({
imports: [
BrowserModule,
DataTableModule,
HttpModule
],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule {

}
35 changes: 0 additions & 35 deletions examples/systemjs/src/app.ts

This file was deleted.

6 changes: 3 additions & 3 deletions examples/systemjs/src/data.json
Expand Up @@ -420,7 +420,7 @@
"age": 21
},
{
"name": "Arden",
"name": "arden",
"email": "tincidunt.nunc.ac@nibhenim.ca",
"regDate": "2017-01-29T12:42:50-08:00",
"city": "Wolkrange",
Expand Down Expand Up @@ -602,7 +602,7 @@
"age": 30
},
{
"name": "Alec",
"name": "alec",
"email": "in@aliquameu.org",
"regDate": "2015-04-21T03:17:43-07:00",
"city": "Harlingen",
Expand Down Expand Up @@ -644,7 +644,7 @@
"age": 40
},
{
"name": "Acton",
"name": "acton",
"email": "consequat.auctor@Quisque.org",
"regDate": "2017-01-19T05:53:38-08:00",
"city": "Motta Camastra",
Expand Down
8 changes: 4 additions & 4 deletions examples/systemjs/src/main.ts
@@ -1,5 +1,5 @@
import {bootstrap} from '@angular/platform-browser-dynamic';
import {platformBrowserDynamic} from "@angular/platform-browser-dynamic";
import {AppModule} from "./AppModule";

import { App } from './app';

bootstrap(App);
const platform = platformBrowserDynamic();
platform.bootstrapModule(AppModule);
92 changes: 46 additions & 46 deletions examples/systemjs/systemjs.conf.js
@@ -1,48 +1,48 @@
(function(global) {

// map tells the System loader where to look for things
var map = {
'src': 'build', // 'dist',
'rxjs': 'node_modules/rxjs',
'@angular': 'node_modules/@angular',
'angular2-datatable': 'node_modules/angular2-datatable',
'lodash': 'node_modules/lodash/lodash.js',
};

// packages tells the System loader how to load when no filename and/or no extension
var packages = {
'src': { main: 'main.js', defaultExtension: 'js' },
'rxjs': { defaultExtension: 'js' },
'angular2-datatable': { defaultExtension: 'js' },
'lodash': { defaultExtension: 'js' },
};

var packageNames = [
'@angular/common',
'@angular/compiler',
'@angular/core',
'@angular/http',
'@angular/platform-browser',
'@angular/platform-browser-dynamic',
// '@angular/router',
// '@angular/router-deprecated',
// '@angular/testing',
// '@angular/upgrade',
];

// add package entries for angular packages in the form '@angular/common': { main: 'index.js', defaultExtension: 'js' }
packageNames.forEach(function(pkgName) {
packages[pkgName] = { main: 'index.js', defaultExtension: 'js' };
/**
* System configuration for Angular samples
* Adjust as necessary for your application needs.
*/
(function (global) {
System.config({
paths: {
// paths serve as alias
'npm:': 'node_modules/'
},
// map tells the System loader where to look for things
map: {
// our app is within the app folder
src: 'build',
// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
// other libraries
'rxjs': 'npm:rxjs',
'angular2-datatable': 'npm:angular2-datatable',
'lodash': 'npm:lodash'
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
src: {
main: './main.js',
defaultExtension: 'js'
},
rxjs: {
defaultExtension: 'js'
},
'angular2-datatable': {
main: 'index.js',
defaultExtension: 'js'
},
lodash: {
main: 'lodash.js',
defaultExtension: 'js'
}
}
});

var config = {
map: map,
packages: packages
};

// filterSystemConfig - index.html's chance to modify config before we register it.
if (global.filterSystemConfig) { global.filterSystemConfig(config); }

System.config(config);

})(this);
3 changes: 1 addition & 2 deletions datatable.d.ts → index.d.ts
Expand Up @@ -2,5 +2,4 @@ export {DataTable, DataEvent, PageEvent, SortEvent} from './lib/DataTable';
export {DefaultSorter} from './lib/DefaultSorter';
export {Paginator} from './lib/Paginator';
export {BootstrapPaginator} from './lib/BootstrapPaginator';

export const DataTableDirectives: any[];
export {DataTableModule} from './lib/DataTableModule';
9 changes: 2 additions & 7 deletions datatable.js → index.js
Expand Up @@ -2,6 +2,7 @@ var dataTable_directive = require('./lib/DataTable');
var defaultSorter_directive = require('./lib/DefaultSorter');
var paginator_component = require('./lib/Paginator');
var bootstrapPaginator_component = require('./lib/BootstrapPaginator');
var dataTable_module = require('./lib/DataTableModule');

exports.DataTable = dataTable_directive.DataTable;
exports.DataEvent = dataTable_directive.DataEvent;
Expand All @@ -10,10 +11,4 @@ exports.SortEvent = dataTable_directive.SortEvent;
exports.DefaultSorter = defaultSorter_directive.DefaultSorter;
exports.Paginator = paginator_component.Paginator;
exports.BootstrapPaginator = bootstrapPaginator_component.BootstrapPaginator;

exports.DataTableDirectives = [
dataTable_directive.DataTable,
defaultSorter_directive.DefaultSorter,
paginator_component.Paginator,
bootstrapPaginator_component.BootstrapPaginator
];
exports.DataTableModule = dataTable_module.DataTableModule;
20 changes: 17 additions & 3 deletions karma-test-shim.js
Expand Up @@ -15,17 +15,31 @@ System.config({
map: Object.keys(window.__karma__.files).filter(onlyAppFiles).reduce(createPathRecords, {})
},
'@angular/core': {
main: 'index.js',
main: 'bundles/core.umd.js',
defaultExtension: 'js'
},
'@angular/common': {
main: 'bundles/common.umd.js',
defaultExtension: 'js'
},
'@angular/platform-browser': {
main: 'index.js',
main: 'bundles/platform-browser.umd.js',
defaultExtension: 'js'
},
'rxjs': {
main: 'Rx.js',
defaultExtension: 'js'
},
'traceur': {
main: 'traceur.js',
defaultExtension: 'js'
}
},
map: {
'lodash': '/base/node_modules/lodash/lodash.js',
'@angular': 'base/node_modules/@angular'
'@angular': 'base/node_modules/@angular',
'rxjs': 'base/node_modules/rxjs',
'traceur': 'base/node_modules/traceur/bin'
}
});

Expand Down
4 changes: 3 additions & 1 deletion karma.conf.js
Expand Up @@ -8,7 +8,7 @@ module.exports = function(config) {
files: [
// paths loaded by Karma
'node_modules/traceur/bin/traceur-runtime.js',
{pattern: 'node_modules/es6-shim/es6-shim.js', included: true, watched: true},
{pattern: 'node_modules/core-js/client/shim.js', included: true, watched: true},
{pattern: 'node_modules/zone.js/dist/zone.js', included: true, watched: true},
{pattern: 'node_modules/reflect-metadata/Reflect.js', included: true, watched: true},
{pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: true},
Expand All @@ -19,6 +19,8 @@ module.exports = function(config) {
// paths loaded via module imports
{pattern: 'lib/**/*.js', included: false, watched: true},
{pattern: 'node_modules/@angular/**/*.js', included: false, watched: true},
{pattern: 'node_modules/rxjs/**/*.js', included: false, watched: true},
{pattern: 'node_modules/traceur/**/*.js', included: false, watched: true},

// paths to support debugging with source maps in dev tools
{pattern: 'src/**/*.ts', included: false, watched: false},
Expand Down

0 comments on commit bf13b87

Please sign in to comment.