diff --git a/ng2-components/ng2-alfresco-viewer/README.md b/ng2-components/ng2-alfresco-viewer/README.md
index dd408ffabe..36ef77c70f 100644
--- a/ng2-components/ng2-alfresco-viewer/README.md
+++ b/ng2-components/ng2-alfresco-viewer/README.md
@@ -1,4 +1,5 @@
# Alfresco File Viewer Component for Angular 2
+
+ selector: 'alfresco-app-demo',
+ template: `
- `,
- directives: [VIEWERCOMPONENT]
+ `
})
class MyDemoApp {
- fileNodeId: any;
-
- constructor() {
- this.fileNodeId = '09469a81-1ed9-4caa-a5df-8362fc3d096f';
+ constructor(private authService: AlfrescoAuthenticationService, private settingsService: AlfrescoSettingsService) {
+ settingsService.ecmHost = 'http://localhost:8080';
+
+ this.authService.login('admin', 'admin').subscribe(
+ ticket => {
+ console.log(ticket);
+ },
+ error => {
+ console.log(error);
+ });
}
}
-bootstrap(MyDemoApp, [
- VIEWERCOMPONENT
-]);
+
+@NgModule({
+ imports: [
+ BrowserModule,
+ CoreModule.forRoot(),
+ ViewerModule.forRoot()
+ ],
+ declarations: [ MyDemoApp ],
+ bootstrap: [ MyDemoApp ]
+})
+export class AppModule { }
+
+platformBrowserDynamic().bootstrapModule(AppModule);
+
```
#### Basic usage with urlFile
@@ -115,25 +159,45 @@ bootstrap(MyDemoApp, [
Example of an App that declares the file viewer component :
```ts
-import { Component } from '@angular/core';
-import { bootstrap } from '@angular/platform-browser-dynamic';
-import { VIEWERCOMPONENT } from 'ng2-alfresco-viewer';
+import { NgModule, Component } from '@angular/core';
+import { BrowserModule } from '@angular/platform-browser';
+import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
+import { CoreModule, AlfrescoSettingsService, AlfrescoAuthenticationService } from 'ng2-alfresco-core';
+import { ViewerModule } from 'ng2-alfresco-viewer';
@Component({
- selector: 'my-app',
- template: `
+ selector: 'alfresco-app-demo',
+ template: `
- `,
- directives: [VIEWERCOMPONENT]
+ `
})
class MyDemoApp {
- constructor() {
- console.log('constructor');
+
+ constructor(private authService: AlfrescoAuthenticationService, private settingsService: AlfrescoSettingsService) {
+ settingsService.ecmHost = 'http://localhost:8080';
+
+ this.authService.login('admin', 'admin').subscribe(
+ ticket => {
+ console.log(ticket);
+ },
+ error => {
+ console.log(error);
+ });
}
}
-bootstrap(MyDemoApp, [
- VIEWERCOMPONENT
-]);
+
+@NgModule({
+ imports: [
+ BrowserModule,
+ CoreModule.forRoot(),
+ ViewerModule.forRoot()
+ ],
+ declarations: [ MyDemoApp ],
+ bootstrap: [ MyDemoApp ]
+})
+export class AppModule { }
+
+platformBrowserDynamic().bootstrapModule(AppModule);
```
#### Options
@@ -157,26 +221,28 @@ Text | pdf
## Build from sources
+
Alternatively you can build component from sources with the following commands:
+
```sh
npm install
npm run build
```
-##Build the files and keep watching for changes
+### Build the files and keep watching for changes
+
+```sh
+$ npm run build:w
+```
- ```sh
- $ npm run build:w
- ```
-
## Running unit tests
```sh
npm test
```
-## Running unit tests in browser
+### Running unit tests in browser
```sh
npm test-browser
@@ -185,7 +251,7 @@ npm test-browser
This task rebuilds all the code, runs tslint, license checks and other quality check tools
before performing unit testing.
-## Code coverage
+### Code coverage
```sh
npm run coverage
@@ -201,25 +267,7 @@ npm install
npm start
```
+## License
-## History
+[Apache Version 2.0](https://github.com/Alfresco/alfresco-ng2-components/blob/master/LICENSE)
-For detailed changelog, check [Releases](https://github.com/alfresco/ng2-alfresco-viewer/releases).
-
-## Contributors
-
-[Contributors](https://github.com/alfresco/ng2-alfresco-viewer/graphs/contributors)
-
-
-[npm-image]: https://badge.fury.io/js/ng2-alfresco-viewer.svg
-[npm-url]: https://npmjs.org/package/ng2-alfresco-viewer
-[travis-image]: https://travis-ci.org/alfresco/ng2-alfresco-viewer.svg?branch=master
-[travis-url]: https://travis-ci.org/alfresco/ng2-alfresco-viewer
-[daviddm-image]: https://david-dm.org/alfresco/ng2-alfresco-viewer.svg?theme=shields.io
-[daviddm-url]: https://david-dm.org/alfresco/ng2-alfresco-viewer
-[coveralls-image]: https://coveralls.io/repos/alfresco/ng2-alfresco-viewer/badge.svg
-[coveralls-url]: https://coveralls.io/r/alfresco/ng2-alfresco-viewer
-[style-url]: https://github.com/mgechev/angular2-style-guide
-[style-image]: https://mgechev.github.io/angular2-style-guide/images/badge.svg
-[alfrescocomponent-image]: https://img.shields.io/badge/Alfresco%20component-approved-green.svg
-[alfrescocomponent-url]: https://www.alfresco.com
diff --git a/ng2-components/ng2-alfresco-viewer/demo/package.json b/ng2-components/ng2-alfresco-viewer/demo/package.json
index 23d7a464e6..ff16381bf9 100644
--- a/ng2-components/ng2-alfresco-viewer/demo/package.json
+++ b/ng2-components/ng2-alfresco-viewer/demo/package.json
@@ -17,29 +17,6 @@
},
"license": "Apache-2.0",
"dependencies": {
- "@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/router": "3.0.0",
- "@angular/upgrade": "2.0.0",
- "@types/node": "^6.0.42",
- "core-js": "^2.4.1",
- "reflect-metadata": "^0.1.3",
- "rxjs": "5.0.0-beta.12",
- "systemjs": "0.19.27",
- "zone.js": "^0.6.23",
-
- "material-design-icons": "2.2.3",
- "material-design-lite": "1.2.1",
- "pdfjs-dist": "1.5.258",
-
- "ng2-translate": "2.5.0",
- "ng2-alfresco-core": "^0.3.0",
- "alfresco-js-api": "^0.3.0",
"ng2-alfresco-viewer": "0.3.2"
},
"devDependencies": {
diff --git a/ng2-components/ng2-alfresco-viewer/demo/src/main.ts b/ng2-components/ng2-alfresco-viewer/demo/src/main.ts
index 378184d205..26796f0ac3 100644
--- a/ng2-components/ng2-alfresco-viewer/demo/src/main.ts
+++ b/ng2-components/ng2-alfresco-viewer/demo/src/main.ts
@@ -33,16 +33,21 @@ import { ViewerModule } from 'ng2-alfresco-viewer';
operations.
- `
+
+ File node id:
+ `
})
class MyDemoApp {
+
+ fileNodeId: string;
+
authenticated: boolean;
ecmHost: string = 'http://127.0.0.1:8080';
diff --git a/ng2-components/ng2-alfresco-viewer/package.json b/ng2-components/ng2-alfresco-viewer/package.json
index 7e320d2ea2..361a9228e4 100644
--- a/ng2-components/ng2-alfresco-viewer/package.json
+++ b/ng2-components/ng2-alfresco-viewer/package.json
@@ -46,23 +46,6 @@
"alfresco"
],
"dependencies": {
- "@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/router": "3.0.0",
- "@angular/upgrade": "2.0.0",
- "@types/node": "^6.0.42",
- "core-js": "^2.4.1",
- "reflect-metadata": "^0.1.3",
- "rxjs": "5.0.0-beta.12",
- "systemjs": "0.19.27",
- "zone.js": "^0.6.23",
- "ng2-translate": "2.5.0",
- "alfresco-js-api": "^0.3.0",
"ng2-alfresco-core": "0.3.2",
"pdfjs-dist": "1.5.404"
},