npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular2-disqus

v6.1.1

Published

Disqus integration with Angular.

Downloads

9

Readme

angular2-disqus

DISQUS integration with Angular 2.

Install

npm install --save angular2-disqus

Setup

Add the DISQUS script

Add the DISQUS embed in the body of your main page (index.html) making sure to change the url to your disqus site url.

Breaking change as of v3 the embed script must now be in the body of the page not the head

<html>

<head>
 <title>demo app</title>
 <meta charset="UTF-8">
 <meta name="viewport" content="width=device-width, initial-scale=1">

 <base href="/">

 <link href="../node_modules/@angular2-material/core/style/core.css" rel="stylesheet">

 <!-- Polyfill(s) for older browsers -->
 <script src="../node_modules/core-js/client/shim.min.js"></script>

 <script src="../node_modules/zone.js/dist/zone.js"></script>
 <script src="../node_modules/reflect-metadata/Reflect.js"></script>
 <script src="../node_modules/systemjs/dist/system.src.js"></script>

 <script src="../public/js/systemjs.config.js"></script>

 <script>
     System.import('demo').catch(function(err){ console.error(err); });
   </script>
</head>

<body>
 <demo-app>Loading...</demo-app>
 <script src="//angular2disqustest.disqus.com/embed.js"></script>
</body>

</html>

SystemJS

In the SystemJs config file (systemjs.config.js) add a mapping for the package

var map = {
    ...
    'angular2-disqus': 'node_modules/angular2-disqus/lib'
};

and add the package to the list of packages

var packages = {
   ...
   'angular2-disqus': { main: 'disqus.module.js', defaultExtension: 'js' }
};

or for angular-cli

Just install the package and then import the module as below.

Usage

At the relevant level for your app add import the DisqusModule.

For example in app.module.ts

import { NgModule }       from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { FormsModule } from '@angular/forms';

import { AppComponent }   from './app.component';
import { DemoComponent } from './demo.component';

import { DisqusModule } from 'angular2-disqus';

import { MdCardModule } from '@angular2-material/card';
import { MdToolbarModule } from '@angular2-material/toolbar';
import { MdButtonModule } from '@angular2-material/button';
import { MdInputModule } from '@angular2-material/input';

@NgModule({
    imports: [
        //A2 stuff
        BrowserModule,
        FormsModule,
        //src module
        DisqusModule,
        //material modules
        MdCardModule,
        MdToolbarModule,
        MdButtonModule,
        MdInputModule
    ],
    declarations: [
        AppComponent
    ],
    bootstrap: [
        AppComponent
    ]

})
export class AppModule { }

To add a comments section add it as a nested component on your component and set the pageIdentifier and the pageUrl.

<disqus-thread [page-identifier]="pageIdentifier" [page-url]="pageUrl"></disqus-thread>

The comments section will be reset everytime either page-identifier or page-url are updated and both have a value. Note to avoid issues with comments showing up on the wrong page always set both.

Future

Add support for comment counts?? https://help.disqus.com/customer/portal/articles/565624-tightening-your-disqus-integration