Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. import { Component, OnInit } from '@angular/core';
  2. import { DynamicScriptLoaderService } from '../../shared/service/DynamicScriptLoaderService';
  3.  
  4. @Component({
  5. selector: 'app-home',
  6. templateUrl: './home.component.html',
  7. styleUrls: ['./home.component.css']
  8. })
  9. export class HomeComponent implements OnInit {
  10.  
  11. constructor(private dynamicScriptLoader: DynamicScriptLoaderService) { }
  12.  
  13. ngOnInit() {
  14. this.loadScripts();
  15. }
  16. private loadScripts() {
  17. // You can load multiple scripts by just providing the key as argument into load method of the service
  18. this.dynamicScriptLoader.load('jquery', 'popper', 'bootstrap').then(data => {
  19. // Script Loaded Successfully
  20. }).catch(error => console.log(error));
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement