Skip to content

How to use alertify.js with Angular CLI: 1.5.4? #154

@ShadowQueen

Description

@ShadowQueen

Hello,

I am trying to use alertify.js with Angular CLI: 1.5.4, but no luck.
In the package.json file I have these packages:

"@types/alertify": "^0.3.30",
"alertify.js": "^1.0.12",

Angular CLI: 1.5.4
Node: 8.9.1
OS: win32 x64
Angular: 5.1.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.5.4
@angular-devkit/build-optimizer: 0.0.36
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.42
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.4
@schematics/angular: 0.1.11
@schematics/schematics: 0.0.11
typescript: 2.4.2
webpack: 3.8.1
Also, I have included in angular-cli.json styles and js for alertify.

I have imported alertify.js in the component:

import * as alertify from 'alertify.js';

deletePart(selectedItem: any) {
    alertify.set({ buttonReverse: true });   // alertify is undefined
    alertify.set({ labels: { ok: this.notifications.Ok, cancel: this.notifications.Cancel } });
}

Error message:

TabPositionsComponent.html:74 ERROR TypeError: WEBPACK_IMPORTED_MODULE_7_alertify_js.set is not a function
at TabPositionsComponent.deletePart (tab-positions.component.ts:201)
at Object.eval [as handleEvent] (TabPositionsComponent.html:77)
at handleEvent (core.js:13581)
at callWithDebugContext (core.js:15090)
at Object.debugHandleEvent [as handleEvent] (core.js:14677)
at dispatchEvent (core.js:9990)
at eval (core.js:10611)
at HTMLButtonElement.eval (platform-browser.js:2628)
at ZoneDelegate.invokeTask (zone.js:425)
at Object.onInvokeTask (core.js:4744)

Am I doing something wrong? Any help would be appreciated?

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions