There seems to be a missing @NgModule and @Directive declarations in an NPM module, even though they exist in the source code on Github. This is causing an issue with importing a directive for databinding from an HTML attribute.
I am attempting to utilize the angular-gtag package to log custom dimensions to Google Analytics using the [params] attribute as described in the readme here: https://github.com/codediodeio/angular-gtag
<div gtagEvent trackOn="click" action="myAction" [params]="{ myDimension: myDimensionValue}"></div>
Where myDimensionValue is a variable within the containing component.
This results in an error:
Template parse errors:
Can't bind to 'params' since it isn't a known property of 'div'.
After researching this error (like here: Angular 4 Can't bind to <property> since it isn't a known property of <component> or here: Can't bind to 'x' since it isn't a known property of 'y'), it appears that adding the GtagEventDirective class to the declarations in app.module.ts could resolve the issue.
Yet, doing so triggers the error:
Unexpected module 'GtagModule' declared by the module 'AppModule'. Please add a @Pipe/@Directive/@Component annotation
Upon inspection of the package's source in node_modules, there are no @Component or @Directive annotations present. Interestingly, these annotations do exist in the module's source code on Github: https://github.com/codediodeio/angular-gtag/blob/master/lib/src/gtag-event.directive.ts and https://github.com/codediodeio/angular-gtag/blob/master/lib/src/gtag.module.ts
What steps can I take next? Modifying the code in node_modules doesn't seem ideal, and any changes may not be recognized as there are already transpiled files in the package.
I have attempted to reinstall the package. It appears that I am using the latest version (1.0.3) as indicated in the Github source. However, the issue persists.
While creating an issue in the Github repository is an option, the source code there is accurate. Any necessary changes are already incorporated. The problem appears to lie between NPM and my local environment.