diff --git a/demo-shell-ng2/app/app.component.html b/demo-shell-ng2/app/app.component.html
index da422e7ec5..c5d2a1d1e7 100644
--- a/demo-shell-ng2/app/app.component.html
+++ b/demo-shell-ng2/app/app.component.html
@@ -12,14 +12,13 @@
@@ -34,7 +33,7 @@
-
+
@@ -42,14 +41,13 @@
diff --git a/demo-shell-ng2/app/app.component.ts b/demo-shell-ng2/app/app.component.ts
index 580ddaa81e..680da7d310 100644
--- a/demo-shell-ng2/app/app.component.ts
+++ b/demo-shell-ng2/app/app.component.ts
@@ -16,8 +16,7 @@
*/
import { Component } from '@angular/core';
-import { Router, RouteConfig, ROUTER_DIRECTIVES } from '@angular/router-deprecated';
-import { FilesComponent } from './components/files/files.component';
+import { ROUTER_DIRECTIVES, Router } from '@angular/router';
import {
MDL,
@@ -26,15 +25,8 @@ import {
AlfrescoPipeTranslate,
AlfrescoAuthenticationService
} from 'ng2-alfresco-core';
-import { UploadButtonComponent } from 'ng2-alfresco-upload';
-import { DataTableDemoComponent } from './components/datatable/datatable-demo.component';
-import { SearchComponent } from './components/search/search.component';
-import { SearchBarComponent } from './components/search/search-bar.component';
-import { LoginDemoComponent } from './components/login/login-demo.component';
-import { TasksDemoComponent } from './components/tasks/tasks-demo.component';
-import { ActivitiDemoComponent } from './components/activiti/activiti-demo.component';
-import { WebscriptComponent } from './components/webscript/webscript.component';
-import { AboutComponent } from './components/about/about.component';
+
+import { SearchBarComponent } from './components/index';
declare var document: any;
@@ -45,19 +37,6 @@ declare var document: any;
directives: [SearchBarComponent, ROUTER_DIRECTIVES, MDL],
pipes: [AlfrescoPipeTranslate]
})
-@RouteConfig([
- {path: '/home', name: 'Home', component: FilesComponent},
- {path: '/files', name: 'Files', component: FilesComponent},
- {path: '/datatable', name: 'DataTable', component: DataTableDemoComponent},
- {path: '/', name: 'Login', component: LoginDemoComponent, useAsDefault: true},
- {path: '/uploader', name: 'Uploader', component: UploadButtonComponent},
- {path: '/login', name: 'Login', component: LoginDemoComponent},
- {path: '/search', name: 'Search', component: SearchComponent},
- {path: '/tasks', name: 'Tasks', component: TasksDemoComponent},
- {path: '/activiti', name: 'Activiti', component: ActivitiDemoComponent},
- {path: '/webscript', name: 'Webscript', component: WebscriptComponent},
- {path: '/about', name: 'About', component: AboutComponent}
-])
export class AppComponent {
translate: AlfrescoTranslationService;
searchTerm: string = '';
@@ -90,10 +69,6 @@ export class AppComponent {
localStorage.setItem(`bpmHost`, this.bpmHost);
}
- isActive(instruction: any[]): boolean {
- return this.router.isRouteActive(this.router.generate(instruction));
- }
-
isLoggedIn(): boolean {
return this.auth.isLoggedIn();
}
@@ -102,7 +77,7 @@ export class AppComponent {
event.preventDefault();
this.auth.logout()
.subscribe(
- () => this.router.navigate(['Login'])
+ () => this.router.navigate(['/login'])
);
}
diff --git a/demo-shell-ng2/app/app.routes.ts b/demo-shell-ng2/app/app.routes.ts
new file mode 100644
index 0000000000..3e35f00d1f
--- /dev/null
+++ b/demo-shell-ng2/app/app.routes.ts
@@ -0,0 +1,46 @@
+/*!
+ * @license
+ * Copyright 2016 Alfresco Software, Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { provideRouter, RouterConfig } from '@angular/router';
+
+import {
+ FilesComponent,
+ UploadButtonComponent,
+ DataTableDemoComponent,
+ SearchComponent,
+ LoginDemoComponent,
+ ActivitiDemoComponent,
+ WebscriptComponent,
+ AboutComponent
+} from './components/index';
+
+export const routes: RouterConfig = [
+ { path: 'home', component: FilesComponent },
+ { path: 'files', component: FilesComponent },
+ { path: 'datatable', component: DataTableDemoComponent },
+ { path: '', component: LoginDemoComponent },
+ { path: 'uploader', component: UploadButtonComponent },
+ { path: 'login', component: LoginDemoComponent },
+ { path: 'search', component: SearchComponent },
+ { path: 'activiti', component: ActivitiDemoComponent },
+ { path: 'webscript', component: WebscriptComponent },
+ { path: 'about', component: AboutComponent }
+];
+
+export const appRouterProviders = [
+ provideRouter(routes)
+];
diff --git a/demo-shell-ng2/app/components/index.ts b/demo-shell-ng2/app/components/index.ts
new file mode 100644
index 0000000000..412bb7f97d
--- /dev/null
+++ b/demo-shell-ng2/app/components/index.ts
@@ -0,0 +1,26 @@
+/*!
+ * @license
+ * Copyright 2016 Alfresco Software, Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export { UploadButtonComponent } from 'ng2-alfresco-upload';
+export { DataTableDemoComponent } from './datatable/datatable-demo.component';
+export { SearchComponent } from './search/search.component';
+export { SearchBarComponent } from './search/search-bar.component';
+export { LoginDemoComponent } from './login/login-demo.component';
+export { ActivitiDemoComponent } from './activiti/activiti-demo.component';
+export { WebscriptComponent } from './webscript/webscript.component';
+export { AboutComponent } from './about/about.component';
+export { FilesComponent } from './files/files.component';
diff --git a/demo-shell-ng2/app/components/login/login-demo.component.ts b/demo-shell-ng2/app/components/login/login-demo.component.ts
index 7e15db73f9..060e6241c5 100644
--- a/demo-shell-ng2/app/components/login/login-demo.component.ts
+++ b/demo-shell-ng2/app/components/login/login-demo.component.ts
@@ -17,7 +17,7 @@
import { Component } from '@angular/core';
import { AlfrescoLoginComponent } from 'ng2-alfresco-login';
-import { Router, ROUTER_DIRECTIVES } from '@angular/router-deprecated';
+import { ROUTER_DIRECTIVES, Router } from '@angular/router';
declare let __moduleName: string;
@@ -37,7 +37,7 @@ export class LoginDemoComponent {
onLogin($event) {
console.log($event);
- this.router.navigate(['Home']);
+ this.router.navigate(['/home']);
}
onError($event) {
diff --git a/demo-shell-ng2/app/components/search/search-bar.component.ts b/demo-shell-ng2/app/components/search/search-bar.component.ts
index 9b7704815e..a55f630e1c 100644
--- a/demo-shell-ng2/app/components/search/search-bar.component.ts
+++ b/demo-shell-ng2/app/components/search/search-bar.component.ts
@@ -16,7 +16,7 @@
*/
import { Component, EventEmitter, Output } from '@angular/core';
-import { Router } from '@angular/router-deprecated';
+import { Router } from '@angular/router';
import { ALFRESCO_SEARCH_DIRECTIVES } from 'ng2-alfresco-search';
import { VIEWERCOMPONENT } from 'ng2-alfresco-viewer';
import {
diff --git a/demo-shell-ng2/app/main.ts b/demo-shell-ng2/app/main.ts
index 118d21a748..1ae1a4152d 100644
--- a/demo-shell-ng2/app/main.ts
+++ b/demo-shell-ng2/app/main.ts
@@ -16,17 +16,18 @@
*/
import { bootstrap } from '@angular/platform-browser-dynamic';
-import { ROUTER_PROVIDERS } from '@angular/router-deprecated';
import { HTTP_PROVIDERS } from '@angular/http';
import { ALFRESCO_SEARCH_PROVIDERS } from 'ng2-alfresco-search';
import { ALFRESCO_CORE_PROVIDERS } from 'ng2-alfresco-core';
import { UploadService } from 'ng2-alfresco-upload';
import { AppComponent } from './app.component';
+import { appRouterProviders } from './app.routes';
+
bootstrap(AppComponent, [
- ROUTER_PROVIDERS,
+ appRouterProviders,
HTTP_PROVIDERS,
ALFRESCO_CORE_PROVIDERS,
ALFRESCO_SEARCH_PROVIDERS,
UploadService
-]);
+]).catch(err => console.error(err));
diff --git a/demo-shell-ng2/systemjs.config.js b/demo-shell-ng2/systemjs.config.js
index 020ebdbd3e..70c4466d67 100644
--- a/demo-shell-ng2/systemjs.config.js
+++ b/demo-shell-ng2/systemjs.config.js
@@ -62,8 +62,13 @@
}
// Most environments should use UMD; some (Karma) need the individual index files
var setPackageConfig = System.packageWithIndex ? packIndex : packUmd;
+
// Add package entries for angular packages
ngPackageNames.forEach(setPackageConfig);
+
+ // No umd for router yet
+ packages['@angular/router'] = { main: 'index.js', defaultExtension: 'js' };
+
var config = {
map: map,
packages: packages