0.0.1 • Published 4 years ago

agr-load-iframe v0.0.1

Weekly downloads
3
License
-
Repository
-
Last release
4 years ago

AgrLoadIFrame

Directive to indicate that an iframe is loaded

Installation

Using npm:

npm install agr-load-iframe

Usage

In app.module:

// Angular
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

// Modulos
import { AppRoutingModule } from './app-routing.module';
import { AgrLoadIframeModule } from 'agr-load-iframe';

// Componentes
import { AppComponent } from './app.component';
import { ExampleAgrLoadIframeComponent } from './example/example-agr-load-iframe/showcase-agr-load-iframe.component';


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

In your ts:

import { Component, OnInit } from '@angular/core';
import { AgrSpinnerService } from 'agr-spinner';

@Component({
  selector: 'app-example-agr-load-iframe',
  templateUrl: './example-agr-load-iframe.component.html',
  styleUrls: ['./v-agr-load-iframe.component.css']
})
export class ExampleAgrLoadIframeComponent implements OnInit {

  constructor(private agrSpinner: AgrSpinnerService) {
    this.agrSpinner.showSpinner();
  }

  ngOnInit() {
  }

  load() {
    console.log("Load iframe");
    this.agrSpinner.hideSpinner();
  }
}

In your html:

<iframe src="http://someweb.com" agrLoadIframe (loadIframe)="load()"></iframe>

<agr-spinner></agr-spinner>

Outputs

OutputDescription
loadIframeEvent when iframe is loaded
0.0.1

4 years ago