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

ng2-comment

v0.0.9

Published

Comment Module in Angular 2 for Anonymous User

Downloads

12

Readme

ng2-comment

A Comment module for Anonymous User, developed in Angular 2 Typescript with Math Captcha.

Features

  1. Anonymous user can post a message.
  2. Math Captcha to identify human user.
  3. Comments and Replies in tree structure
  4. Links for Upvotes and Downvotes
  5. Pagination

Demo

Here is the demo.

Installation

Assumptions:

  • An Angular 2 application is already available/installed. (if not, ng2-comment-demo application may be installed).
  • Server side coding is already available/installed. (if not, a server side code available in backend folder of ng2-comment-demo application may be used. Server side code is developed on nodejs and mongodb)

Step 1:

npm install ng2-comment --save

Step 2:

In an application module, say app.module.ts, ensure following entries:

...  
import { HttpModule } from '@angular/http';  
import { CommentModule } from 'ng2-comment';  
...  
@NgModule ({  
	...  
	imports: [  
		...  
		HttpModule,
		CommentModule,  
		...  
	],  
	...  
})  

Step 3:

Comment module needs to know, server address to save/retrieve comments. Such input is made through a config object. To avoid 'config' name collision with other such names in the application, an opaque token is used.

In a component file, say app.component.ts, ensure following entries:

import { OpaqueToken, Inject } from '@angular/core';  
...  
const APP_CONFIG_DATA = {  
	server_ip_addr: 'http://localhost:9090'  
}  
const APP_CONFIG_TOKEN = new OpaqueToken('config');  
...  
  
@Component ({  
	...  
	templateUrl: './app.component.html',  
	...  
	providers: [  
		{ provide: APP_CONFIG_TOKEN, useValue: APP_CONFIG_DATA }  
	],  
	...  
})  
export class AppComponent {  
	...  
	constructor( @Inject(APP_CONFIG_TOKEN) public config: OpaqueToken) {}  
	...  
}  

Step 4: In the template file app.component.html, ensure following entry:

...  
<div class="col-xs-6 col-xs-offset-3">  
	<comment [config]=config></comment>  
</div>  
...      

Step 5: In the application's index.html file, include link to bootstrap css as ng2-comment uses it.

<!DOCTYPE html>  
<html>  
  <head>  

	...  
  
	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/	bootstrap.min.css">  
  
	...  
  
  </head>  
  <body>  
    <my-app>Loading...</my-app>  
  </body>  
</html>  

Step 6: Run the server and client. If ng2-comment-demo is installed, open a terminal to run server: npm run server, it runs at port 9090. Open another terminal to run client, npm start (ie. ng2-comment-demo), which runs at port 8080.

Step 7: Open browser at url, say http://localhost:8080. It shows the Comment Form with list of comments.

License

MIT