Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot find name 'NgcInitializeEvent' and 'NgcStatusChangeEvent' AND Cannot read property 'initialise' of undefined #2

Closed
Byloor opened this issue Oct 5, 2017 · 5 comments
Labels

Comments

@Byloor
Copy link

Byloor commented Oct 5, 2017

Hi,

I would like to use ngx-cookie consent package in my angular 4 application(built with angular cli) . I do not have a systemjs file. Hence except that part , I followed each step as in the documentation . I am having 4 error messages
two errors with following message

  1. Cannot read property 'initialise' of undefined
    at NgcCookieConsentService.init (cookieconsent.service.js:53)
    at new NgcCookieConsentService (cookieconsent.service.js:23)
    at _createClass (core.es5.js:9532)
    at createProviderInstance$1 (core.es5.js:9500)
    at resolveNgModuleDep (core.es5.js:9485)
    at NgModuleRef
    .get (core.es5.js:10577)
    at resolveDep (core.es5.js:11080)
    at createClass (core.es5.js:10933)
    at createDirectiveInstance (core.es5.js:10764)
    at createViewNodes (core.es5.js:12212)

  2. Cannot find name 'NgcInitializeEvent'.
    Cannot find name 'NgcStatusChangeEvent'.

Please help.

@tinesoft
Copy link
Owner

tinesoft commented Oct 5, 2017

Hi @Byloor

Please for your future issues, provide the minimum info mentioned in the issue template (when creating it): angular-cli version, repro steps (which command of angular-cli produces the error,..) etc. This helps me help you faster!

Concerning your error 1 , it almost like it could not found cookieconsent.js library. Please try this:

  • rm -rf node_modules (to be safe)
  • npm i --save cookieconsent
  • npm i --save ngx-cookieconsent
  • edit .angular-cli.json:
"scripts": [
        "../node_modules/cookieconsent/build/cookieconsent.min.js"
      ],

      "styles": [
        "../node_modules/cookieconsent/build/cookieconsent.min.css"
      ],
  • ng serve

@Byloor
Copy link
Author

Byloor commented Oct 5, 2017

@tinesoft
Thank you , It works! I dont know what was wrong thou, the only thing i hadn't run was

  • rm -rf node_modules

And for the second error : i added
import { NgcInitializeEvent , NgcStatusChangeEvent } from 'ngx-cookieconsent';
in the app.component.ts file. and it was resolved!

@tinesoft
Copy link
Owner

tinesoft commented Oct 5, 2017

I suspect the dependencies have not been installed correctly the 1st time.
Sometime a simple rm -rf node_modules can help solving many issues with node packages! 😄

@tinesoft tinesoft closed this as completed Oct 5, 2017
@Byloor
Copy link
Author

Byloor commented Oct 5, 2017

@tinesoft
Sorry,:/ Issue is not resolved completely.Clicking on "GOT IT" button hides the banner. But it re-appears if i load again . Is there a time period I have to mention. And my browser does save cookies( I verified).

The way I resolved second error does not seem to be right as cookies status is not kept into account.
The error is
Cannot find name 'NgcInitializeEvent'.
Cannot find name 'NgcStatusChangeEvent'. in app.component.ts file

@mastermind3043-zz
Copy link

I faced issue #1 because I'd skipped the dependency for insites' js

laagland pushed a commit to gmaknl/ngx-cookieconsent that referenced this issue Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants