angular-rut

WebJar for angular-rut

License

License

MIT
Categories

Categories

Angular User Interface Web Frameworks
GroupId

GroupId

org.webjars.bower
ArtifactId

ArtifactId

angular-rut
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

angular-rut
WebJar for angular-rut
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/platanus/angular-rut

Download angular-rut

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.bower/angular-rut/ -->
<dependency>
    <groupId>org.webjars.bower</groupId>
    <artifactId>angular-rut</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bower/angular-rut/
implementation 'org.webjars.bower:angular-rut:1.0.1'
// https://jarcasting.com/artifacts/org.webjars.bower/angular-rut/
implementation ("org.webjars.bower:angular-rut:1.0.1")
'org.webjars.bower:angular-rut:jar:1.0.1'
<dependency org="org.webjars.bower" name="angular-rut" rev="1.0.1">
  <artifact name="angular-rut" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bower', module='angular-rut', version='1.0.1')
)
libraryDependencies += "org.webjars.bower" % "angular-rut" % "1.0.1"
[org.webjars.bower/angular-rut "1.0.1"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

angular-rut Bower version Build Status

An Angular module with several components to handle Chilean RUT validation, cleaning and formatting. It includes:

  • ngRut: a directive to easily add validation, cleaning and formatting to any element with an associated ng-model value
  • rut: a filter to format valid RUTs with dots and dashes (11.111.111-1) in the view
  • RutHelper: a constant you can inject in your modules and exposes individual methods for validation, cleaning and formatting.

angular-rut is no longer maintained.

  • We will leave the Issues open as a discussion forum only.
  • We do not guarantee a response from us in the Issues.
  • We are no longer accepting pull requests.

Installation

Just use Bower.

bower install angular-rut --save

Then, inject it into your application:

angular.module('MyApp', ['platanus.rut']);

Directive

Add the ng-rut directive to any element with an associated ng-model to automatically perform validation, cleaning and formatting.

<input ng-rut type="text" ng-model="model.rut">

The directive does the following:

  • It validates whether the input is a valid RUT (by using $setValidity),
  • passes a clean RUT (numbers and K only) to the model,
  • and formats the view by adding dots and dashes (11.111.111-1).

Options

You can use the rut-format attribute to define when should the view be formatted:

  • live: Format as the RUT changes (e.g. as a user types into the input):
<input ng-rut rut-format="live" type="text">
  • blur: Format when the input is blurred:
<input ng-rut rut-format="blur" type="text">

Filter

Use it just like any Angular filter. It takes a (presumably valid) RUT, cleans and formats it.

{{ model.rut | rut }} 

RutHelper

Inject it as a dependency anywhere you like:

app.controller('RutCtrl', ['RutHelper', function(RutHelper){ ...

Then use it like so:

RutHelper.format('111111111'); // returns 11.111.111-1

There are three methods available:

  • RutHelper.clean(rut) strips every character except numbers and the letter K.
  • RutHelper.format(rut) cleans and formats the RUT number with dots and dashes (e.g 11.111.111-1).
  • RutHelper.validate(rut) returns a boolean indicating whether the given RUT is valid.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Credits

Thank you contributors!

Platanus

angular-rut is maintained by platanus.

License

It is free software and may be redistributed under the terms specified in the LICENSE file.

org.webjars.bower

Platanus

We develop challenging software projects that require innovation and agility.

Versions

Version
1.0.1