• This repository has been archived on 09/Jul/2020
  • Stars
    star
    197
  • Rank 197,722 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 11 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Provides "slugification" for AngularJS

angular-slugify

Provides “slugification” for AngularJS in the form of a service, filter, and a directive.

What is a slug?

A slug is that final portion of a URL which is derived from some other piece of information, usually the title of a page.

For example, “Man Bites Dog” might produce the slug man-bites-dog for the URL:

http://example.com/2013/04/man-bites-dog.html

Demo

Click here for demo.

Usage

Include angular-slugify.js in your HTML document somewhere after you have set up AngularJS.

<script src="angular-slugify.js">

Make slugifier a dependency in your AngularJS app.

angular.module("myApp", ["slugifier"]);

Service

The Slug service provides a single function slugify that takes a string input as argument and returns the slugified string.

function MyCtrl($scope, Slug) {
    $scope.slugify = function(input) {
        $scope.mySlug = Slug.slugify(input);
    };
}

Filter

The slugify filter slugifies any text passed to it in an AngularJS curly-brace expression.

<input type="text" ng-model="title">
<p>Slug: {{title | slugify}}</p>

Directive

The slug directive is a way to declaratively say one model is the slugification of another.

<slug from="post.title" to="post.slug">My slug is {{post.slug}}</slug>
<p>It also works out here: {{post.slug}}</p>

The from attribute is the name of the model in the current scope you want to slugify. The to attribute is the name of the model you want to be automatically updated with the slugification whenever from changes.

Tests

$ npm test

License

Copyright © 2013 Paul Smith [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

gogeos

Go library for spatial data operations and geometric algorithms (Go bindings for GEOS)
Go
280
star
2

getting-started-llvm-c-api

Getting started with the LLVM C API
C
112
star
3

tweetarchive

Full-text search for your Twitter archive
JavaScript
85
star
4

geonode

[ABANDONED] Geography for node.js, see README
C++
71
star
5

templatemaker

templatemaker is a Python library that can extract data from files with a similar format, like HTML pages.
Python
63
star
6

tablestruct

tablestruct creates mappings between Go structs and database tables.
Go
59
star
7

texteditor-zig

make your own text editor (in Zig)
Zig
22
star
8

quickserver

Starts a simple file-serving HTTP server in a directory and opens the default web browser to the root URL
Shell
20
star
9

geodjango

GeoDjango provides geospatial extensions to the Django web dev framework
Python
20
star
10

fli-hole

A pi-hole deployed into Fly.io and transported with Tailscale
Shell
20
star
11

newrelic-go-agent

(Unofficial) New Relic agent for the Go language, wraps the Agent SDK
Go
17
star
12

cMarkdown

Markdown for Python, accelerated by C.
C
16
star
13

hwcounter

Highly accurate counter for measuring elapsed time in Python
C
13
star
14

CureAudiod

OS X menu bar app for restarting coreaudiod and VDCAssistant
Swift
6
star
15

chicago_wards_and_precincts

Chicago wards and precincts (effective 2015)
Go
4
star
16

viterbi

Find most likely sequence of hidden states (Viterbi path) in a hidden Markov model
Go
4
star
17

reloader.sh

automatically trigger a reload of a process when a file change is detected
Shell
4
star
18

yourreps

YourReps.org
Python
4
star
19

sqlite-schema-viz

Generate graph visualization of a SQLite database schema
Go
3
star
20

writing-an-interpreter-in-go-in-zig

"Writing an Interpreter in Go" in Zig
Zig
2
star
21

htmx-go-example

Example web application using htmx with Go
Go
2
star
22

aws-ssh

Simple app to generate SSH host configs for instances in VPCs behind bastion hosts
Go
2
star
23

civicfootprint

Find out who represents you
2
star
24

nixos-config

NixOS (and nix-darwin) configuration, including home-manager
Lua
2
star
25

letsgetlouder

Django community website for pledging not to attend conferences unless they have a code of conduct policy
JavaScript
2
star
26

ztl

Templating language for Zig, modeled after Django's templates
Zig
1
star
27

pushup-template-fragments-demo

demo of template fragments (aka inline partials) in Pushup app
CSS
1
star
28

8080-emulator

Software version of the Intel 8080 CPU.
C
1
star
29

backbone-d3-examples

Using Backbone.js and D3.js together
JavaScript
1
star
30

baudot

Baudot/ITA2 decoder/encoder
C
1
star
31

hershey

Generate the Hershey vector font set
Go
1
star
32

gnucobol

Mirror of the SVN repository of GnuCOBOL project.
C
1
star
33

boundvariable

My solution to universal machine part of the 2006 ICFP Programming Contest
C
1
star
34

enums

Generate methods for Go enum-likes
Go
1
star
35

oriole

OpenBSD firewall/router home LAN configuration
Makefile
1
star
36

kaleidoscope

C port of the LLVM tutorial
1
star
37

pbimg

pbpaste for image data on macOS
Swift
1
star