9.1.11 • Published 5 years ago

@noammazuz/vzn-media v9.1.11

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

VznMedia

Usage example


Import Module

app.module.ts

import { VznMediaModule } from 'vzn-media';

@NgModule({
  imports: [
    VznMediaModule.forRoot({
      defaultImgSrc: 'assets/images/image_placeholder.png', 
      maxImageSize: 512, 
    })
  ]
})

example.component.ts

import { VznMediaComponent } from 'vzn-media';

export class ExampleComponent {
  @ViewChild('vznMedia', { static: false}) vznMedia: VznMediaComponent;
  uploadUrlService;
  uploadFolder: string;
    .
    .
    .
  ngOnInit() {
    this.restService = this.restApiService.service('users');
    this.uploadUrlService = this.restApiService.service('upload-url');
    this.setFormData( data => {
      this.uploadFolder = `users/${this.id}/`;
    });
  }

  submitted(isNewItem:Boolean): Promise<any> {
    if (isNewItem) {
      return new Promise(async (resolve)=>{
        this.vznMedia.uploadFolder = `users/${this.id}/`;
        await this.vznMedia.upload();
        this.submit();
      });
    }
  }
    .
    .
    .
}

example.component.html

    <vzn-media #vznMedia formControlName="profileImage" 
        [uploadFolder]="uploadFolder" 
        [uploadUrlService]="uploadUrlService"
        [autoUpload]="id!=undefined" 
        (onUploadStart)="submitDisabled = true"
        (onUploadEnd)="(id)?submit(false):0; submitDisabled = false" 
        (onDeleted)="false"
    ></vzn-media>

This library was generated with Angular CLI version 8.2.9.

Code scaffolding

Run ng generate component component-name --project vzn-media to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module --project vzn-media.

Note: Don't forget to add --project vzn-media or else it will be added to the default project in your angular.json file.

Build

Run ng build vzn-media to build the project. The build artifacts will be stored in the dist/ directory.

Publishing

After building your library with ng build vzn-media, go to the dist folder cd dist/vzn-media and run npm publish.

Running unit tests

Run ng test vzn-media to execute the unit tests via Karma.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.

9.1.11

5 years ago

9.1.10

5 years ago

0.1.10

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.25

5 years ago

0.0.24

5 years ago

0.0.23

5 years ago

0.0.22

5 years ago

0.0.21

5 years ago

0.0.20

5 years ago

0.0.19

5 years ago

0.0.18

5 years ago

0.0.17

5 years ago

0.0.16

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago