Skip to content
This repository was archived by the owner on Sep 7, 2020. It is now read-only.

Commit f948d6e

Browse files
author
Douglas Ludlow
committed
Update everything to rc6, fix demo/tests.
1 parent 88d43b9 commit f948d6e

24 files changed

+328
-273
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: node_js
22
node_js:
33
- "5"
4-
- "4"
4+
- "6"
55

66
script:
77
- npm run build

demo/app.component.ts

+2-14
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
1-
import { Component, OnInit } from '@angular/core';
2-
import { ROUTER_DIRECTIVES, Router } from '@angular/router';
3-
4-
import { appRouterProviders } from './app.routes';
1+
import { Component } from '@angular/core';
52

63
@Component({
74
selector: 'modal-demo',
85
template: '<router-outlet></router-outlet>',
9-
providers: [appRouterProviders],
10-
directives: [ROUTER_DIRECTIVES]
116
})
12-
export class AppComponent implements OnInit {
13-
14-
constructor(private router: Router) {
15-
}
16-
17-
ngOnInit() {
18-
this.router.navigate(['/']);
19-
}
7+
export class AppComponent{
208
}

demo/app.module.ts

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { NgModule } from '@angular/core';
2+
import { BrowserModule } from '@angular/platform-browser';
3+
import { FormsModule } from '@angular/forms';
4+
import { Ng2Bs3ModalModule } from '../src/ng2-bs3-modal/ng2-bs3-modal';
5+
import { routing } from './app.routes';
6+
import { AppComponent } from './app.component';
7+
import { ModalDemoComponent } from './modal-demo.component';
8+
import { HelloComponent } from './hello.component';
9+
10+
@NgModule({
11+
imports: [
12+
BrowserModule,
13+
FormsModule,
14+
routing,
15+
Ng2Bs3ModalModule
16+
],
17+
declarations: [
18+
AppComponent,
19+
ModalDemoComponent,
20+
HelloComponent
21+
],
22+
bootstrap: [AppComponent]
23+
})
24+
export class AppModule {
25+
}

demo/app.routes.ts

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import { provideRouter, RouterConfig } from '@angular/router';
1+
import { ModuleWithProviders } from '@angular/core';
2+
import { Routes, RouterModule } from '@angular/router';
23

34
import { ModalDemoComponent } from './modal-demo.component';
45
import { HelloComponent } from './hello.component';
56

6-
const routes: RouterConfig = [
7-
{path: '', component: ModalDemoComponent},
8-
{path: 'hello', component: HelloComponent}
7+
const routes: Routes = [
8+
{ path: '', component: ModalDemoComponent },
9+
{ path: 'hello', component: HelloComponent }
910
];
1011

11-
export const appRouterProviders = [
12-
provideRouter(routes)
13-
];
12+
export const routing: ModuleWithProviders = RouterModule.forRoot(routes);

demo/hello.component.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import { Component } from '@angular/core';
2-
import { ROUTER_DIRECTIVES } from '@angular/router';
32

43
@Component({
54
selector: 'hello-component',
6-
directives: [ROUTER_DIRECTIVES],
75
template: `
86
<section class="container">
97
<h1>Hello</h1>

demo/main.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { bootstrap } from '@angular/platform-browser-dynamic';
2-
import { AppComponent } from './app.component';
1+
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
2+
import { AppModule } from './app.module';
33

4-
bootstrap(AppComponent, []);
4+
platformBrowserDynamic().bootstrapModule(AppModule);

demo/modal-demo.component.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ <h4 class="modal-title">I'm a modal!</h4>
8787
<modal-body>
8888
<div class="form-group">
8989
<label for="firstName">First Name</label>
90-
<input type="text" class="form-control" required [(ngModel)]="model.firstName" ngControl="firstName" #firstName="ngForm">
90+
<input type="text" class="form-control" required [(ngModel)]="model.firstName" name="firstName" id="firstName">
9191
</div>
9292
<div class="form-group">
9393
<label for="lastName">Last Name</label>
94-
<input type="text" class="form-control" required [(ngModel)]="model.lastName" ngControl="lastName" #lastName="ngForm">
94+
<input type="text" class="form-control" required [(ngModel)]="model.lastName" name="lastName" id="lastName">
9595
</div>
9696
</modal-body>
9797
<modal-footer>

demo/modal-demo.component.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
import {Component, ViewChild, ViewEncapsulation} from '@angular/core';
22
import { Router } from '@angular/router';
3-
import { MODAL_DIRECTIVES, ModalComponent } from '../src/ng2-bs3-modal/ng2-bs3-modal';
3+
import { ModalComponent } from '../src/ng2-bs3-modal/ng2-bs3-modal';
44

55
@Component({
66
selector: 'modal-demo-component',
77
templateUrl: 'demo/modal-demo.component.html',
8-
directives: [MODAL_DIRECTIVES],
98
styles: [
109
`.ng-valid[required] {
1110
border-left: 5px solid #5cb85c; /* green */
1211
}`,
13-
`.ng-invalid {
12+
`.ng-invalid:not(.ng-untouched):not(form) {
1413
border-left: 5px solid #d9534f; /* red */
1514
}`,
1615
`.red-text {

demo/tsconfig.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"compilerOptions": {
3+
"module": "commonjs",
4+
"moduleResolution": "node",
5+
"target": "es5",
6+
"noImplicitAny": false,
7+
"emitDecoratorMetadata": true,
8+
"experimentalDecorators": true,
9+
"inlineSourceMap": true,
10+
"declaration": false
11+
}
12+
}

index.html

+17-18
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1">
66
<title>Angular2 Bootstrap3 Modal Component</title>
7-
<base href="/ng2-bs3-modal/">
7+
<base href="/">
88

99
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.css">
1010

1111
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.0/es6-shim.min.js"></script>
12-
<script src="https://unpkg.com/[email protected].12?main=browser"></script>
12+
<script src="https://unpkg.com/[email protected].17?main=browser"></script>
1313
<script src="https://unpkg.com/[email protected]"></script>
14-
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.27/system.js"></script>
15-
<script src="https://unpkg.com/typescript@1.8.10/lib/typescript.js"></script>
14+
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
15+
<script src="https://unpkg.com/typescript@2.0.0/lib/typescript.js"></script>
1616

1717
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.js"></script>
1818
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.js"></script>
1919

2020
<script>
2121
System.config({
22-
baseURL: '/ng2-bs3-modal/',
22+
baseURL: '/',
2323
transpiler: 'typescript',
2424
typescriptOptions: {
2525
emitDecoratorMetadata: true,
@@ -28,22 +28,21 @@
2828
packages: {
2929
'demo': {main: 'main', defaultExtension: 'ts'},
3030
'src': {defaultExtension: 'ts'},
31-
'@angular/common': {main: 'index.js', defaultExtension: 'js'},
32-
'@angular/compiler': {main: 'index.js', defaultExtension: 'js'},
33-
'@angular/core': {main: 'index.js', defaultExtension: 'js'},
34-
'@angular/platform-browser': {main: 'index.js', defaultExtension: 'js'},
35-
'@angular/platform-browser-dynamic': {main: 'index.js', defaultExtension: 'js'},
36-
'@angular/router': {main: 'index.js', defaultExtension: 'js'},
3731
'rxjs': { defaultExtension: 'js' }
3832
},
33+
paths: {
34+
'npm:': 'https://unpkg.com/'
35+
},
3936
map: {
40-
'@angular/common': 'https://unpkg.com/@angular/[email protected]',
41-
'@angular/compiler': 'https://unpkg.com/@angular/[email protected]',
42-
'@angular/core': 'https://unpkg.com/@angular/[email protected]',
43-
'@angular/platform-browser': 'https://unpkg.com/@angular/[email protected]',
44-
'@angular/platform-browser-dynamic': 'https://unpkg.com/@angular/[email protected]',
45-
'@angular/router': 'https://unpkg.com/@angular/[email protected]',
46-
'rxjs': 'https://unpkg.com/[email protected]'
37+
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
38+
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
39+
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
40+
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
41+
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
42+
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
43+
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
44+
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
45+
'rxjs': 'npm:rxjs',
4746
}
4847
});
4948
System.import('demo').catch(function(err){ console.error(err); });

karma.conf.js

+31-11
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,44 @@ module.exports = function (config) {
88
frameworks: ['jasmine'],
99
reporters: ['spec'],
1010
browsers: ['PhantomJS'],
11-
//browsers: ['Chrome'],
11+
// browsers: ['Chrome'],
1212
files: [
13-
'node_modules/es6-shim/es6-shim.min.js',
14-
'node_modules/systemjs/dist/system-polyfills.js',
15-
'node_modules/systemjs/dist/system.src.js',
1613
'node_modules/typescript/lib/typescript.js',
17-
'node_modules/zone.js/dist/zone.js',
18-
'node_modules/reflect-metadata/Reflect.js',
1914
'node_modules/jquery/dist/jquery.js',
2015
'node_modules/bootstrap/dist/js/bootstrap.js',
21-
'test/test-main.js',
16+
'node_modules/jasmine-jquery-matchers/dist/jasmine-jquery-matchers.js',
17+
18+
// System.js for module loading
19+
'node_modules/systemjs/dist/system.src.js',
20+
'node_modules/systemjs/dist/system-polyfills.js',
21+
22+
// Polyfills
23+
'node_modules/core-js/client/shim.js',
24+
'node_modules/reflect-metadata/Reflect.js',
25+
26+
// zone.js
27+
'node_modules/zone.js/dist/zone.js',
28+
'node_modules/zone.js/dist/long-stack-trace-zone.js',
29+
'node_modules/zone.js/dist/proxy.js',
30+
'node_modules/zone.js/dist/sync-test.js',
31+
'node_modules/zone.js/dist/jasmine-patch.js',
2232
'node_modules/zone.js/dist/async-test.js',
2333
'node_modules/zone.js/dist/fake-async-test.js',
24-
'node_modules/zone.js/dist/sync-test.js',
25-
{ pattern: 'node_modules/@angular/**/*.js', included: false, served: true },
26-
{ pattern: 'node_modules/rxjs/**/*.js', included: false, served: true },
34+
35+
// RxJs
36+
{ pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false },
37+
{ pattern: 'node_modules/rxjs/**/*.js.map', included: false, watched: false },
38+
39+
// Paths loaded via module imports:
40+
// Angular itself
41+
{ pattern: 'node_modules/@angular/**/*.js', included: false, watched: false },
42+
{ pattern: 'node_modules/@angular/**/*.js.map', included: false, watched: false },
43+
44+
// Project files
2745
{ pattern: 'src/**/*.ts', included: false, served: true },
28-
{ pattern: 'test/**/*.ts', included: false, served: true }
46+
{ pattern: 'test/**/*.ts', included: false, served: true },
47+
48+
'test/test-main.js',
2949
]
3050
});
3151
};

package.json

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"name": "ng2-bs3-modal",
3-
"version": "0.7.0",
3+
"version": "0.8.0",
44
"description": "Angular2 Boostrap3 Modal Component",
55
"main": "ng2-bs3-modal.js",
66
"scripts": {
7+
"start": "static",
78
"peer": "npm install es6-promise@^3.0.2 es6-shim@^0.33.3 [email protected] [email protected] [email protected]",
89
"lint": "tslint ./src/**/*.ts",
910
"clean": "rimraf ./bundles/ ./components/ ./directives/ ./ng2-bs3-modal.js ./ng2-bs3-modal.d.ts",
@@ -38,26 +39,30 @@
3839
"@angular/common": "2.0.0-rc.6",
3940
"@angular/compiler": "2.0.0-rc.6",
4041
"@angular/core": "2.0.0-rc.6",
42+
"@angular/forms": "^2.0.0-rc.6",
4143
"@angular/platform-browser": "2.0.0-rc.6",
4244
"@angular/platform-browser-dynamic": "2.0.0-rc.6",
4345
"@angular/router": "3.0.0-rc.2",
4446
"bootstrap": "^3.3.6",
47+
"core-js": "^2.4.1",
4548
"es6-shim": "^0.35.0",
4649
"jasmine": "^2.4.1",
50+
"jasmine-jquery-matchers": "^1.1.1",
4751
"jquery": "^2.2.1",
4852
"karma": "^0.13.21",
4953
"karma-chrome-launcher": "^0.2.2",
5054
"karma-jasmine": "^0.3.7",
51-
"karma-phantomjs-launcher": "^1.0.0",
55+
"karma-phantomjs-launcher": "^1.0.2",
5256
"karma-spec-reporter": "0.0.24",
53-
"phantomjs-prebuilt": "2.1.7",
57+
"node-static": "^0.7.8",
58+
"phantomjs-prebuilt": "^2.1.7",
5459
"reflect-metadata": "^0.1.3",
5560
"rimraf": "^2.5.1",
5661
"rxjs": "5.0.0-beta.11",
57-
"systemjs": "^0.19.27",
58-
"tslint": "^3.7.1",
62+
"systemjs": "^0.19.38",
63+
"tslint": "^3.15.1",
5964
"typescript": "2.0.0",
60-
"typings": "^0.7.9",
65+
"typings": "^1.3.3",
6166
"uglify-js": "^2.6.2",
6267
"zone.js": "^0.6.17"
6368
},

src/ng2-bs3-modal/components/modal-body.ts

-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ import { ModalComponent } from './modal';
1010
`
1111
})
1212
export class ModalBodyComponent {
13-
constructor(private modal: ModalComponent) { }
1413
}

src/ng2-bs3-modal/components/modal-footer.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, Input, Output, EventEmitter, Type } from '@angular/core';
1+
import { Component, Input, Inject } from '@angular/core';
22
import { ModalComponent } from './modal';
33

44
@Component({
@@ -15,5 +15,5 @@ export class ModalFooterComponent {
1515
@Input('show-default-buttons') showDefaultButtons: boolean = false;
1616
@Input('dismiss-button-label') dismissButtonLabel: string = 'Dismiss';
1717
@Input('close-button-label') closeButtonLabel: string = 'Close';
18-
constructor(private modal: ModalComponent) { }
18+
constructor(@Inject(ModalComponent) private modal: ModalComponent) { }
1919
}

src/ng2-bs3-modal/components/modal-header.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, Input, Output, EventEmitter, Type } from '@angular/core';
1+
import { Component, Input, Inject } from '@angular/core';
22
import { ModalComponent } from './modal';
33

44
@Component({
@@ -14,5 +14,5 @@ import { ModalComponent } from './modal';
1414
})
1515
export class ModalHeaderComponent {
1616
@Input('show-close') showClose: boolean = false;
17-
constructor(private modal: ModalComponent) { }
17+
constructor(@Inject(ModalComponent) private modal: ModalComponent) { }
1818
}

src/ng2-bs3-modal/components/modal.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, OnDestroy, Input, Output, EventEmitter, Type, ElementRef, HostBinding } from '@angular/core';
1+
import { Component, OnDestroy, Input, Output, EventEmitter, Type, ElementRef, HostBinding, Inject } from '@angular/core';
22
import { ModalInstance, ModalResult } from './modal-instance';
33

44
@Component({
@@ -45,7 +45,7 @@ export class ModalComponent implements OnDestroy {
4545
return this.backdrop;
4646
}
4747

48-
constructor(private element: ElementRef) {
48+
constructor(@Inject(ElementRef) private element: ElementRef) {
4949
this.instance = new ModalInstance(this.element);
5050

5151
this.instance.hidden.subscribe((result) => {

src/ng2-bs3-modal/directives/autofocus.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { Directive, ElementRef } from '@angular/core';
1+
import { Directive, ElementRef, Inject, Optional } from '@angular/core';
22
import { ModalComponent } from '../components/modal';
33

44
@Directive({
55
selector: '[autofocus]'
66
})
77
export class AutofocusDirective {
8-
constructor(private el: ElementRef, private modal: ModalComponent) {
9-
if (modal != null) {
8+
constructor(@Inject(ElementRef) private el: ElementRef, @Inject(ModalComponent) @Optional() private modal: ModalComponent) {
9+
if (!modal) {
1010
this.modal.onOpen.subscribe(() => {
1111
this.el.nativeElement.focus();
1212
});

0 commit comments

Comments
 (0)