New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

angular2-busy-directive

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular2-busy-directive

Show a loading indicator based on observables.

  • 1.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Angular 2 busy directive

Build Status

This is a simple package which can show a loading indicator based on an observable.

The package comes with a default loading component. However it is possible to inject your own.

Installation

npm i --save angular2-busy-directive

Setup

First thing you need to do is import the BusyModule into your root module.

@NgModule({
    declarations: [...]
	imports: [
        BusyModule,
        ...

    ],
	providers: [...]
})
export class AppModule {

}

The second thing you need to do is use the rvBusy directive on an html tag.

@Component({
    selector: 'app-sample',
    template: `
        <div [rvBusy]="locations$">
            <pre>{{locations$ | async}}</pre>
        </div>
    `
})
class SampleComponent implements OnInit {
    locations$: Observable<any>;

    constructor(private http: HttpClient) {}

    ngOnInit() {
        this.busy = this.http.get('...');
    }
}

That's all!

Custom loading component

To inject your own loading component you have to do the following.

Declare your component in the entryComponents of your root module.

@NgModule({
    declarations: [...]
	imports: [
        BusyModule,
        ...

    ],
    entryComponents: [
        MyCustomComponent
    ],
	providers: [...]
})
export class AppModule {

}

Inject your component into the directive rvComponent.

@Component({
    selector: 'app-sample',
    template: `
        <div [rvBusy]="locations$" [rvComponent]="component">
            <pre>{{locations$ | async}}</pre>
        </div>
    `
})
class SampleComponent implements OnInit {
    locations$: Observable<any>;
    component = MyCustomComponent;

    constructor(private http: HttpClient) {}

    ngOnInit() {
        this.busy = this.http.get('...');
    }
}

Keywords

FAQs

Package last updated on 03 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc