Angular Disqus Module


Keywords
disqus, angular2, angular, comments
License
MIT
Install
npm install ng2-awesome-disqus@1.1.1

Documentation

Angular Disqus Module

Add Disqus to your app instantly!

npm npm Build Status npm bundle size (minified + gzip) npm

Installation

Install it with npm

$ npm install --save ngx-disqus

SystemJS

If you are using SystemJS, you should also adjust your configuration to point to the UMD bundle.

In your systemjs config file, map needs to tell the System loader where to look for ngx-disqus:

map: {
  'ngx-disqus': 'node_modules/ngx-disqus/bundles/ngx-disqus.umd.js',
}

Here is a stackblitz

Usage

Import DisqusModule in the root module

import { DisqusModule } from "ngx-disqus";
@NgModule({
  imports: [
    // ...
    DisqusModule.forRoot('disqus_shortname')
  ]
})

The paramter shortname is the unique identifier for your website as registered on Disqus, make sure it is defined in your module.

Now you can add Disqus component

@Component({
  selector: 'any-component',
  template: `<disqus [identifier]="pageId"></disqus>`
})
export class AnyComponent {

  pageId = '/about';
}

Disqus component requires the identifier input to work properly on your app For example If the page URL is localhost:4200/about then the identifier should be /about.

More Options

See Disqus official documentation (JavaScript configuration variables) before using these inputs.

<disqus [identifier]="pageId" [url]="url" [category]="catId" [language]="'en'"
        (newComment)="onComment($event)" (ready)="onReady($event)" (paginate)="onPaginate($event)"></disqus>

NOTE

The HashLocationStrategy is not compatible with Disqus

For more info check DISQUS on ajax sites


Issues

If you identify any errors in this component, or have an idea for an improvement, please open an issue. I am excited to see what the community thinks of this project, and I would love your input!

Author

Murhaf Sousli

More plugins