Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to implement boomerangjs in my Angular code. But it's not working for me. I need your help to resolve it. Below is the way I've used it. So first I've installed boomerangjs using npm and it's now available in my node_modules. My first page is dashboard.component.ts, so I've added below code in this component.

import {BOOMR} from 'node_modules/boomerangjs';

    export class DashboardComponent implements OnInit {
      ngOnInit() {         
         BOOMR.init({
          beacon_url: "/beacon"
        });   
        }
    }

However I am getting TypeError: Cannot read property 'init' of undefined error. Please help how can I use "boomerangjs " in my angular code.

I am able to see 3 dots ... on top of page where import is listed. When I hover on dots getting below message:

Could not find a declaration file for module 'node_modules/boomerangjs'. 'd:/code/node_modules/boomerangjs/boomerang.js' implicitly has an 'any' type.
  Try `npm install @types/boomerangjs` if it exists or add a new declaration (.d.ts) file containing `declare module 'boomerangjs';`




Please help Thanks

What I have tried:

I tried to import boomerangjs using below ways. Even I created boomerang.d.ts and referred in tsconfig.json but nothing is working for me. 

//import * as BOOMR from 'node_modules/boomerangjs';
//import  "node_modules/boomerangjs/boomerang.d.ts";
const BOOMR = require('node_modules/boomerangjs');
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900