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-click-to-edit

v1.0.52

Published

wrap your data-binding to make it editable.

Downloads

76

Readme

Angular 2 Click-To-Edit

##Click on a data-binding to make it an input field, and save the changes!

Examples:

  • Plunker Example - http://plnkr.co/edit/4dGYAe?p=info

Newly Added!

  • Easy permission enabling/disabling edit functionality.
  • Easy to attach Field-Validation.

This Version Has:

  • Easy to implement component to wrap your bindings.
  • onSave event that calls your own save method.
  • Nice looking css style(inspired by Jira)
  • Canceling method when choosing to cancel or when clicking outside.

Installation

    npm install angular2-click-to-edit

How To Use:

Adding package to SystemJS:

systemjs.config.js

 var map = {
	'angular2-click-to-edit': 'node_modules/angular2-click-to-edit',
	}
 var packages = {
	'angular2-click-to-edit': { main: 'index' }  
 }

Step 1:

component.ts

 // Import to the component where you want to implement the click-to-edit.
 import { NDV_DIRECTIVES } from 'angular2-click-to-edit/components';

 // Include it in the Component directives
 @Component({
 	 directives: [NDV_DIRECTIVES]
 })

Step 2:

page.html

<!- This is your uneditible regular binding: ->
<p>{{user.firstName}}</p>

<!- This is your EDITABLE binding: ->
<p><ndv-edit [title]="'firstName'" [placeholder]='user.firstName' (onSave)='yourSaveMethod($event)'></ndv-edit></p>

Important Notes!

As you can see there are few parameters passed:

  • [title] - this is the name of the field you want to send back to the server. i.e: "email".

  • [placeholder] - this is the text that will be displayed by default(before editing) so we would probably like to bind our data to it.

  • [min] - this one is similar to minlength(for validation) and can set the minimum requirement of chars.

  • [max] - this one is similar to maxlength(for validation) and can limit the number of chars.

-[regex] - this one is similar to pattern(for validation) and can use regular expressions.

  • [permission] - a simple attribute, once equal to false the edit field is changed to read-only.

  • (onSave) - this one takes the function you give it and call it when the user saved his edited info!

VERY IMPORTANT TO NOTICE

$event - is the object containing the information based on the [title]!!!

  • for instance: [title]="firstName"* then $event = { firstName: 'the user edited text' }.

Thanks

  • for this awesome tutorial by Ben Nadel - http://www.bennadel.com/blog/3009-tracking-click-events-outside-the-current-component-in-angular-2-beta-1.html